From 0cf411b09cf5d8970b873a338a69eae98d5ce5d8 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 8 Jun 2024 12:56:43 +0900 Subject: Rename text nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- ChangeLog.immodule | 2 +- doc/application-walkthrough.doc | 6 +- doc/changes.doc | 6 +- doc/classchart.doc | 10 +- doc/dnd.doc | 24 +- doc/features.doc | 4 +- doc/html/addressbook-example.html | 14 +- doc/html/advanced.html | 2 +- doc/html/annotated.html | 20 +- doc/html/basic.html | 2 +- doc/html/canvas-chart-example.html | 4 +- doc/html/chart-chartform_files-cpp.html | 6 +- doc/html/chart-element-cpp.html | 8 +- doc/html/chart-element-h.html | 4 +- doc/html/classchart.html | 10 +- doc/html/classes.html | 20 +- doc/html/clientserver-example.html | 40 +- doc/html/customlayout-example.html | 2 +- doc/html/designer-manual-16.html | 2 +- doc/html/designer-manual-3.html | 10 +- doc/html/dnd.html | 24 +- doc/html/draganddrop.html | 2 +- doc/html/emb-features.html | 4 +- doc/html/functions.html | 380 +- doc/html/grapher-nsplugin-example.html | 8 +- doc/html/headerfilesynonyms | 10 +- doc/html/headers.html | 12 +- doc/html/helpsystem.html | 2 +- doc/html/helpviewer-example.html | 60 +- doc/html/hierarchy.html | 22 +- doc/html/httpd-example.html | 18 +- doc/html/i18n-example.html | 4 +- doc/html/i18n.html | 30 +- doc/html/iconview-simple_dd-main-cpp.html | 12 +- doc/html/index | 506 +- doc/html/io.html | 6 +- doc/html/keyfeatures30.html | 4 +- doc/html/layout-example.html | 2 +- doc/html/linguist-manual-2.html | 4 +- doc/html/linguist-manual-4.html | 2 +- doc/html/mail-example.html | 6 +- doc/html/mainclasses.html | 6 +- doc/html/mdi-example.html | 28 +- doc/html/motif-walkthrough-10.html | 2 +- doc/html/motif-walkthrough-8.html | 8 +- doc/html/ntqapplication.html | 12 +- doc/html/ntqbig5codec.html | 2 +- doc/html/ntqbuffer.html | 8 +- doc/html/ntqdatastream.html | 4 +- doc/html/ntqdockarea.html | 6 +- doc/html/ntqdragobject.html | 2 +- doc/html/ntqdropsite.html | 2 +- doc/html/ntqeucjpcodec.html | 8 +- doc/html/ntqeuckrcodec.html | 6 +- doc/html/ntqfile.html | 18 +- doc/html/ntqgb18030codec.html | 2 +- doc/html/ntqiconview.html | 6 +- doc/html/ntqiodevice.html | 6 +- doc/html/ntqjiscodec.html | 6 +- doc/html/ntqlabel.html | 4 +- doc/html/ntqlineedit.html | 4 +- doc/html/ntqmainwindow.html | 12 +- doc/html/ntqmultilineedit.html | 18 +- doc/html/ntqprocess.html | 4 +- doc/html/ntqscrollview.html | 2 +- doc/html/ntqsimplerichtext.html | 2 +- doc/html/ntqsjiscodec.html | 6 +- doc/html/ntqsplitter.html | 8 +- doc/html/ntqstylesheet.html | 10 +- doc/html/ntqsyntaxhighlighter.html | 8 +- doc/html/ntqt.html | 2 +- doc/html/ntqtextbrowser.html | 265 - doc/html/ntqtextcodec.html | 611 -- doc/html/ntqtextcodecplugin.html | 114 - doc/html/ntqtextedit.html | 1626 ----- doc/html/ntqtextstream.html | 667 -- doc/html/ntqtextview.html | 81 - doc/html/ntqtsciicodec.html | 2 +- doc/html/pictures.html | 8 +- doc/html/plugins-howto.html | 2 +- doc/html/plugins.html | 2 +- doc/html/porting.html | 8 +- doc/html/process-example.html | 8 +- doc/html/propertydocs | 168 +- doc/html/propertyindex | 40 +- doc/html/qaction-application-example.html | 30 +- doc/html/qaxbase.html | 2 +- doc/html/qbig5codec-h.html | 2 +- doc/html/qbig5codec-members.html | 50 +- doc/html/qbig5hkscscodec-members.html | 50 +- doc/html/qbig5hkscscodec.html | 2 +- doc/html/qdir-example.html | 26 +- doc/html/qdockarea-h.html | 2 +- doc/html/qdropevent.html | 2 +- doc/html/qeucjpcodec-h.html | 2 +- doc/html/qeucjpcodec-members.html | 46 +- doc/html/qeuckrcodec-h.html | 2 +- doc/html/qeuckrcodec-members.html | 48 +- doc/html/qfontmanager_qws-h.html | 2 +- doc/html/qgb18030codec-h.html | 2 +- doc/html/qgb18030codec-members.html | 50 +- doc/html/qgb2312codec-members.html | 50 +- doc/html/qgbkcodec-members.html | 50 +- doc/html/qgfx_qws-h.html | 2 +- doc/html/qhebrewcodec-members.html | 46 +- doc/html/qhebrewcodec.html | 6 +- doc/html/qjiscodec-h.html | 2 +- doc/html/qjiscodec-members.html | 48 +- doc/html/qmacmime.html | 2 +- doc/html/qmacstyle.html | 2 +- doc/html/qmainwindow-h.html | 2 +- doc/html/qmimesource.html | 2 +- doc/html/qmimesourcefactory.html | 10 +- doc/html/qmultilineedit-h.html | 2 +- doc/html/qmultilineedit-members.html | 244 +- doc/html/qnamespace-h.html | 2 +- doc/html/qnpstream.html | 2 +- doc/html/qrtlcodec-h.html | 2 +- doc/html/qsjiscodec-h.html | 2 +- doc/html/qsjiscodec-members.html | 48 +- doc/html/qt-template-lib.html | 4 +- doc/html/qt.dcf | 588 +- doc/html/qtextbrowser-h.html | 152 - doc/html/qtextbrowser-m.png | Bin 21643 -> 0 bytes doc/html/qtextbrowser-members.html | 556 -- doc/html/qtextbrowser-w.png | Bin 21690 -> 0 bytes doc/html/qtextcodec-h.html | 179 - doc/html/qtextcodec-members.html | 73 - doc/html/qtextcodecplugin-h.html | 115 - doc/html/qtextcodecplugin-members.html | 52 - doc/html/qtextdecoder-members.html | 48 - doc/html/qtextdecoder.html | 78 - doc/html/qtextdrag-members.html | 107 - doc/html/qtextdrag.html | 129 - doc/html/qtextedit-h.html | 655 -- doc/html/qtextedit-members.html | 544 -- doc/html/qtextencoder-members.html | 48 - doc/html/qtextencoder.html | 79 - doc/html/qtextistream-members.html | 69 - doc/html/qtextistream.html | 91 - doc/html/qtextostream-members.html | 69 - doc/html/qtextostream.html | 90 - doc/html/qtextstream-h.html | 383 - doc/html/qtextstream-members.html | 70 - doc/html/qtextview-h.html | 119 - doc/html/qtextview-members.html | 543 -- doc/html/qtsciicodec-h.html | 2 +- doc/html/qtsciicodec-members.html | 50 +- doc/html/qwerty-example.html | 52 +- doc/html/qwindowsmime.html | 2 +- doc/html/richtext-example.html | 18 +- doc/html/rot-example.html | 8 +- doc/html/scrollview-example.html | 6 +- doc/html/simple-application-example.html | 30 +- doc/html/simple-application.html | 30 +- doc/html/simple-font-demo-example.html | 14 +- doc/html/simple_dd-example.html | 12 +- doc/html/text.html | 10 +- doc/html/titleindex | 56 +- doc/html/tqdomnode.html | 4 +- doc/html/tqobject.html | 4 +- doc/html/tqsqlpropertymap.html | 4 +- doc/html/tqstring.html | 22 +- doc/html/tqtextbrowser-h.html | 152 + doc/html/tqtextbrowser-m.png | Bin 0 -> 21643 bytes doc/html/tqtextbrowser-members.html | 556 ++ doc/html/tqtextbrowser-w.png | Bin 0 -> 21690 bytes doc/html/tqtextbrowser.html | 265 + doc/html/tqtextcodec-h.html | 179 + doc/html/tqtextcodec-members.html | 73 + doc/html/tqtextcodec.html | 611 ++ doc/html/tqtextcodecplugin-h.html | 115 + doc/html/tqtextcodecplugin-members.html | 52 + doc/html/tqtextcodecplugin.html | 114 + doc/html/tqtextdecoder-members.html | 48 + doc/html/tqtextdecoder.html | 78 + doc/html/tqtextdrag-members.html | 107 + doc/html/tqtextdrag.html | 129 + doc/html/tqtextedit-h.html | 655 ++ doc/html/tqtextedit-members.html | 544 ++ doc/html/tqtextedit.html | 1626 +++++ doc/html/tqtextencoder-members.html | 48 + doc/html/tqtextencoder.html | 79 + doc/html/tqtextistream-members.html | 69 + doc/html/tqtextistream.html | 91 + doc/html/tqtextostream-members.html | 69 + doc/html/tqtextostream.html | 90 + doc/html/tqtextstream-h.html | 383 + doc/html/tqtextstream-members.html | 70 + doc/html/tqtextstream.html | 667 ++ doc/html/tqtextview-h.html | 119 + doc/html/tqtextview-members.html | 543 ++ doc/html/tqtextview.html | 81 + doc/html/tqwidget.html | 14 +- doc/html/tqxml-h.html | 2 +- doc/html/tqxmlinputsource.html | 2 +- doc/html/tutorial2-03.html | 14 +- doc/html/tutorial2-07.html | 6 +- doc/html/unicode.html | 6 +- doc/html/whatsthis | 22 +- doc/i18n.doc | 28 +- doc/man/man3/tqapplication.3qt | 16 +- doc/man/man3/tqaxbase.3qt | 2 +- doc/man/man3/tqbig5codec.3qt | 2 +- doc/man/man3/tqbig5hkscscodec.3qt | 2 +- doc/man/man3/tqbuffer.3qt | 8 +- doc/man/man3/tqdatastream.3qt | 4 +- doc/man/man3/tqdockarea.3qt | 14 +- doc/man/man3/tqdomnode.3qt | 8 +- doc/man/man3/tqdragobject.3qt | 2 +- doc/man/man3/tqdropevent.3qt | 2 +- doc/man/man3/tqeucjpcodec.3qt | 8 +- doc/man/man3/tqeuckrcodec.3qt | 6 +- doc/man/man3/tqfile.3qt | 16 +- doc/man/man3/tqfontmetrics.3qt | 8 +- doc/man/man3/tqgb18030codec.3qt | 2 +- doc/man/man3/tqhebrewcodec.3qt | 6 +- doc/man/man3/tqiconview.3qt | 6 +- doc/man/man3/tqiodevice.3qt | 6 +- doc/man/man3/tqjiscodec.3qt | 6 +- doc/man/man3/tqlabel.3qt | 4 +- doc/man/man3/tqlineedit.3qt | 4 +- doc/man/man3/tqmacmime.3qt | 4 +- doc/man/man3/tqmacstyle.3qt | 2 +- doc/man/man3/tqmainwindow.3qt | 16 +- doc/man/man3/tqmimesource.3qt | 2 +- doc/man/man3/tqmimesourcefactory.3qt | 6 +- doc/man/man3/tqnpstream.3qt | 2 +- doc/man/man3/tqobject.3qt | 4 +- doc/man/man3/tqpainter.3qt | 16 +- doc/man/man3/tqprocess.3qt | 4 +- doc/man/man3/tqscrollview.3qt | 2 +- doc/man/man3/tqsimplerichtext.3qt | 2 +- doc/man/man3/tqsjiscodec.3qt | 6 +- doc/man/man3/tqsplitter.3qt | 12 +- doc/man/man3/tqsqlpropertymap.3qt | 2 +- doc/man/man3/tqstring.3qt | 24 +- doc/man/man3/tqstylesheet.3qt | 8 +- doc/man/man3/tqsyntaxhighlighter.3qt | 20 +- doc/man/man3/tqt.3qt | 2 +- doc/man/man3/tqtextbrowser.3qt | 56 +- doc/man/man3/tqtextcodec.3qt | 186 +- doc/man/man3/tqtextcodecplugin.3qt | 34 +- doc/man/man3/tqtextdecoder.3qt | 18 +- doc/man/man3/tqtextdrag.3qt | 30 +- doc/man/man3/tqtextedit.3qt | 442 +- doc/man/man3/tqtextencoder.3qt | 18 +- doc/man/man3/tqtextistream.3qt | 30 +- doc/man/man3/tqtextostream.3qt | 28 +- doc/man/man3/tqtextstream.3qt | 246 +- doc/man/man3/tqtsciicodec.3qt | 2 +- doc/man/man3/tqwidget.3qt | 14 +- doc/man/man3/tqwindowsmime.3qt | 4 +- doc/man/man3/tqxmlinputsource.3qt | 4 +- doc/networking.doc | 4 +- doc/pictures.doc | 8 +- doc/plugins-howto.doc | 2 +- doc/porting3.doc | 14 +- doc/qtl.doc | 10 +- doc/tutorial2.doc | 4 +- doc/unicode.doc | 6 +- examples/README | 4 +- examples/action/application.cpp | 4 +- examples/addressbook/centralwidget.cpp | 2 +- examples/application/application.cpp | 4 +- examples/chart/element.cpp | 2 +- examples/demo/frame.cpp | 2 +- examples/demo/i18n/i18n.cpp | 2 +- examples/demo/opengl/glinfotext.h | 2 +- examples/demo/textdrawing/example.html | 4 +- examples/demo/textdrawing/helpwindow.cpp | 2 +- examples/demo/textdrawing/helpwindow.h | 2 +- examples/demo/textdrawing/textedit.cpp | 2 +- examples/fonts/simple-qfont-demo/viewer.cpp | 2 +- examples/helpviewer/helpwindow.cpp | 2 +- examples/helpviewer/helpwindow.h | 2 +- examples/i18n/main.cpp | 2 +- examples/mdi/application.cpp | 4 +- examples/network/clientserver/client/client.cpp | 4 +- examples/network/clientserver/server/server.cpp | 4 +- examples/network/httpd/httpd.cpp | 4 +- .../network/infoprotocol/infoclient/client.cpp | 4 +- .../network/infoprotocol/infoserver/server.cpp | 4 +- .../network/infoprotocol/infourlclient/client.cpp | 2 +- .../network/infoprotocol/infourlclient/qip.cpp | 2 +- examples/network/mail/smtp.cpp | 2 +- examples/process/process.cpp | 2 +- examples/qdir/qdir.cpp | 6 +- examples/qwerty/qwerty.cpp | 4 +- examples/richtext/richtext.cpp | 2 +- examples/textedit/textedit.cpp | 2 +- examples/thread/prodcons/prodcons.cpp | 2 +- examples/widgets/widgets.cpp | 2 +- extensions/nsplugin/examples/grapher/grapher.cpp | 2 +- include/ntqtextbrowser.h | 1 - include/ntqtextcodec.h | 1 - include/ntqtextcodecfactory.h | 1 - include/ntqtextcodecplugin.h | 1 - include/ntqtextedit.h | 1 - include/ntqtextstream.h | 1 - include/ntqtextview.h | 1 - include/private/qtextcodecinterface_p.h | 1 - include/private/qtextengine_p.h | 1 - include/private/qtextlayout_p.h | 1 - include/private/tqtextcodecinterface_p.h | 1 + include/private/tqtextengine_p.h | 1 + include/private/tqtextlayout_p.h | 1 + include/tqtextbrowser.h | 1 + include/tqtextcodec.h | 1 + include/tqtextcodecfactory.h | 1 + include/tqtextcodecplugin.h | 1 + include/tqtextedit.h | 1 + include/tqtextstream.h | 1 + include/tqtextview.h | 1 + .../src/accessible/widgets/qaccessiblewidget.cpp | 2 +- plugins/src/codecs/cn/main.cpp | 4 +- plugins/src/codecs/jp/main.cpp | 4 +- plugins/src/codecs/kr/main.cpp | 4 +- plugins/src/codecs/tw/main.cpp | 4 +- .../src/inputmethods/xim/qximinputcontext_x11.cpp | 2 +- qmake/Makefile.unix | 8 +- qmake/Makefile.win32-g++ | 10 +- qmake/generators/makefile.cpp | 2 +- qmake/generators/makefile.h | 2 +- qmake/generators/win32/msvc_objectmodel.cpp | 2 +- qmake/generators/win32/winmakefile.cpp | 2 +- qmake/project.cpp | 2 +- src/codecs/ntqbig5codec.h | 2 +- src/codecs/ntqeucjpcodec.h | 2 +- src/codecs/ntqeuckrcodec.h | 2 +- src/codecs/ntqgb18030codec.h | 2 +- src/codecs/ntqjiscodec.h | 2 +- src/codecs/ntqrtlcodec.h | 2 +- src/codecs/ntqsjiscodec.h | 2 +- src/codecs/ntqtextcodec.h | 134 - src/codecs/ntqtextcodecfactory.h | 59 - src/codecs/ntqtextcodecplugin.h | 70 - src/codecs/ntqtsciicodec.h | 2 +- src/codecs/ntqutfcodec.h | 2 +- src/codecs/qfontcodecs_p.h | 2 +- src/codecs/qisciicodec_p.h | 2 +- src/codecs/qrtlcodec.cpp | 2 +- src/codecs/qt_codecs.pri | 14 +- src/codecs/qtextcodec.cpp | 3161 --------- src/codecs/qtextcodecfactory.cpp | 131 - src/codecs/qtextcodecinterface_p.h | 80 - src/codecs/qtextcodecplugin.cpp | 186 - src/codecs/tqtextcodec.cpp | 3161 +++++++++ src/codecs/tqtextcodec.h | 134 + src/codecs/tqtextcodecfactory.cpp | 131 + src/codecs/tqtextcodecfactory.h | 59 + src/codecs/tqtextcodecinterface_p.h | 80 + src/codecs/tqtextcodecplugin.cpp | 186 + src/codecs/tqtextcodecplugin.h | 70 + src/dialogs/qerrormessage.cpp | 2 +- src/dialogs/qprintdialog.cpp | 2 +- src/kernel/ntqnamespace.h | 2 +- src/kernel/ntqt.h | 18 +- src/kernel/qapplication.cpp | 2 +- src/kernel/qapplication_x11.cpp | 2 +- src/kernel/qclipboard_x11.cpp | 2 +- src/kernel/qdragobject.cpp | 2 +- src/kernel/qfont.cpp | 2 +- src/kernel/qfont_x11.cpp | 4 +- src/kernel/qfontengine_p.h | 4 +- src/kernel/qfontengine_x11.cpp | 4 +- src/kernel/qpainter.cpp | 2 +- src/kernel/qpainter_x11.cpp | 8 +- src/kernel/qpsprinter.cpp | 6 +- src/kernel/qpsprinter_p.h | 2 +- src/kernel/qrichtext.cpp | 4 +- src/kernel/qrichtext_p.h | 2 +- src/kernel/qscriptengine.cpp | 2 +- src/kernel/qscriptengine_p.h | 2 +- src/kernel/qscriptengine_x11.cpp | 2 +- src/kernel/qt_kernel.pri | 8 +- src/kernel/qtextengine.cpp | 1180 --- src/kernel/qtextengine_p.h | 377 - src/kernel/qtextengine_unix.cpp | 127 - src/kernel/qtextlayout.cpp | 643 -- src/kernel/qtextlayout_p.h | 184 - src/kernel/tqimage.cpp | 2 +- src/kernel/tqtextengine.cpp | 1180 +++ src/kernel/tqtextengine_p.h | 377 + src/kernel/tqtextengine_unix.cpp | 127 + src/kernel/tqtextlayout.cpp | 643 ++ src/kernel/tqtextlayout_p.h | 184 + src/kernel/tqwidget_x11.cpp | 4 +- src/moc/moc.pro | 4 +- src/network/qdns.cpp | 2 +- src/network/qftp.cpp | 2 +- src/network/qhttp.cpp | 2 +- src/qt.pro | 4 +- src/styles/qsgistyle.cpp | 2 +- src/tools/ntqtextstream.h | 341 - src/tools/ntqtl.h | 2 +- src/tools/qfeatures.txt | 8 +- src/tools/qsettings.cpp | 2 +- src/tools/qt_tools.pri | 4 +- src/tools/qtextstream.cpp | 2632 ------- src/tools/tqstring.cpp | 2 +- src/tools/tqtextstream.cpp | 2632 +++++++ src/tools/tqtextstream.h | 341 + src/widgets/ntqdockarea.h | 2 +- src/widgets/ntqmainwindow.h | 2 +- src/widgets/ntqmultilineedit.h | 2 +- src/widgets/ntqtextbrowser.h | 107 - src/widgets/ntqtextedit.h | 613 -- src/widgets/ntqtextview.h | 74 - src/widgets/qcheckbox.cpp | 2 +- src/widgets/qiconview.cpp | 2 +- src/widgets/qlineedit.cpp | 2 +- src/widgets/qradiobutton.cpp | 2 +- src/widgets/qsyntaxhighlighter.cpp | 2 +- src/widgets/qt_widgets.pri | 12 +- src/widgets/qtextbrowser.cpp | 555 -- src/widgets/qtextedit.cpp | 7474 -------------------- src/widgets/qtextview.cpp | 103 - src/widgets/tqtextbrowser.cpp | 555 ++ src/widgets/tqtextbrowser.h | 107 + src/widgets/tqtextedit.cpp | 7474 ++++++++++++++++++++ src/widgets/tqtextedit.h | 613 ++ src/widgets/tqtextview.cpp | 103 + src/widgets/tqtextview.h | 74 + src/xml/qsvgdevice.cpp | 2 +- src/xml/tqdom.cpp | 4 +- src/xml/tqxml.cpp | 2 +- src/xml/tqxml.h | 2 +- tools/assistant/finddialog.ui | 2 +- tools/assistant/helpdialogimpl.cpp | 4 +- tools/assistant/helpwindow.cpp | 4 +- tools/assistant/helpwindow.h | 2 +- tools/assistant/lib/qassistantclient.cpp | 2 +- tools/assistant/main.cpp | 2 +- tools/assistant/mainwindow.ui | 2 +- tools/assistant/profile.cpp | 2 +- tools/designer/app/main.cpp | 2 +- tools/designer/designer/command.cpp | 2 +- tools/designer/designer/customwidgeteditorimpl.cpp | 4 +- tools/designer/designer/designerappiface.cpp | 2 +- tools/designer/designer/mainwindow.cpp | 2 +- tools/designer/designer/mainwindowactions.cpp | 2 +- tools/designer/designer/metadatabase.cpp | 2 +- tools/designer/designer/multilineeditorimpl.cpp | 2 +- tools/designer/designer/multilineeditorimpl.h | 2 +- tools/designer/designer/outputwindow.cpp | 2 +- tools/designer/designer/pixmapcollection.cpp | 2 +- tools/designer/designer/project.cpp | 4 +- tools/designer/designer/projectsettingsimpl.cpp | 2 +- tools/designer/designer/propertyeditor.cpp | 2 +- tools/designer/designer/resource.cpp | 4 +- tools/designer/designer/resource.h | 2 +- tools/designer/designer/sourceeditor.cpp | 2 +- tools/designer/designer/sourcefile.cpp | 2 +- tools/designer/designer/widgetfactory.cpp | 6 +- tools/designer/designer/workspace.cpp | 2 +- tools/designer/editor/editor.h | 2 +- tools/designer/editor/parenmatcher.cpp | 2 +- tools/designer/editor/yyindent.cpp | 2 +- .../designer/examples/addressbook/addressbook.ui.h | 2 +- tools/designer/examples/richedit/richedit.ui | 2 +- tools/designer/plugins/dlg/dlg2ui.cpp | 2 +- tools/designer/plugins/kdevdlg/kdevdlg2ui.h | 2 +- tools/designer/plugins/rc/rc2ui.h | 2 +- tools/designer/shared/widgetdatabase.cpp | 3 +- tools/designer/tools/tqtcreatecw/main.cpp | 2 +- tools/designer/uic/uic.h | 2 +- tools/designer/uilib/tqwidgetfactory.cpp | 6 +- tools/linguist/book/linguist-manager.leaf | 4 +- tools/linguist/book/linguist-programmer.leaf | 6 +- tools/linguist/linguist/main.cpp | 2 +- tools/linguist/linguist/msgedit.cpp | 4 +- tools/linguist/linguist/phrase.cpp | 2 +- tools/linguist/lrelease/main.cpp | 2 +- tools/linguist/lupdate/fetchtr.cpp | 2 +- tools/linguist/lupdate/main.cpp | 2 +- tools/linguist/shared/metatranslator.cpp | 4 +- tools/linguist/shared/proparser.cpp | 2 +- tools/linguist/tutorial/tt2/main.cpp | 2 +- tools/linguist/tutorial/tt3/main.cpp | 2 +- tools/maketqpf/main.cpp | 2 +- tools/msg2tqm/msg2tqm.cpp | 4 +- tools/qconfig/main.cpp | 2 +- tools/qconfig/main.h | 2 +- tools/qembed/qembed.cpp | 2 +- tools/qtconfig/mainwindow.cpp | 2 +- tools/tqtmergetr/tqtmergetr.cpp | 2 +- tools/tqvfb/skin.cpp | 2 +- translations/qt_ar.ts | 2 +- translations/qt_ca.ts | 2 +- translations/qt_cs.ts | 2 +- translations/qt_de.ts | 2 +- translations/qt_es.ts | 2 +- translations/qt_fr.ts | 2 +- translations/qt_he.ts | 2 +- translations/qt_it.ts | 2 +- translations/qt_ja.ts | 2 +- translations/qt_nb.ts | 2 +- translations/qt_pt-br.ts | 2 +- translations/qt_pt.ts | 2 +- translations/qt_ru.ts | 2 +- translations/qt_sk.ts | 2 +- translations/qt_tr.ts | 2 +- translations/qt_zh-cn.ts | 2 +- translations/qt_zh-tw.ts | 2 +- translations/template.ts | 2 +- 506 files changed, 28639 insertions(+), 28638 deletions(-) delete mode 100644 doc/html/ntqtextbrowser.html delete mode 100644 doc/html/ntqtextcodec.html delete mode 100644 doc/html/ntqtextcodecplugin.html delete mode 100644 doc/html/ntqtextedit.html delete mode 100644 doc/html/ntqtextstream.html delete mode 100644 doc/html/ntqtextview.html delete mode 100644 doc/html/qtextbrowser-h.html delete mode 100644 doc/html/qtextbrowser-m.png delete mode 100644 doc/html/qtextbrowser-members.html delete mode 100644 doc/html/qtextbrowser-w.png delete mode 100644 doc/html/qtextcodec-h.html delete mode 100644 doc/html/qtextcodec-members.html delete mode 100644 doc/html/qtextcodecplugin-h.html delete mode 100644 doc/html/qtextcodecplugin-members.html delete mode 100644 doc/html/qtextdecoder-members.html delete mode 100644 doc/html/qtextdecoder.html delete mode 100644 doc/html/qtextdrag-members.html delete mode 100644 doc/html/qtextdrag.html delete mode 100644 doc/html/qtextedit-h.html delete mode 100644 doc/html/qtextedit-members.html delete mode 100644 doc/html/qtextencoder-members.html delete mode 100644 doc/html/qtextencoder.html delete mode 100644 doc/html/qtextistream-members.html delete mode 100644 doc/html/qtextistream.html delete mode 100644 doc/html/qtextostream-members.html delete mode 100644 doc/html/qtextostream.html delete mode 100644 doc/html/qtextstream-h.html delete mode 100644 doc/html/qtextstream-members.html delete mode 100644 doc/html/qtextview-h.html delete mode 100644 doc/html/qtextview-members.html create mode 100644 doc/html/tqtextbrowser-h.html create mode 100644 doc/html/tqtextbrowser-m.png create mode 100644 doc/html/tqtextbrowser-members.html create mode 100644 doc/html/tqtextbrowser-w.png create mode 100644 doc/html/tqtextbrowser.html create mode 100644 doc/html/tqtextcodec-h.html create mode 100644 doc/html/tqtextcodec-members.html create mode 100644 doc/html/tqtextcodec.html create mode 100644 doc/html/tqtextcodecplugin-h.html create mode 100644 doc/html/tqtextcodecplugin-members.html create mode 100644 doc/html/tqtextcodecplugin.html create mode 100644 doc/html/tqtextdecoder-members.html create mode 100644 doc/html/tqtextdecoder.html create mode 100644 doc/html/tqtextdrag-members.html create mode 100644 doc/html/tqtextdrag.html create mode 100644 doc/html/tqtextedit-h.html create mode 100644 doc/html/tqtextedit-members.html create mode 100644 doc/html/tqtextedit.html create mode 100644 doc/html/tqtextencoder-members.html create mode 100644 doc/html/tqtextencoder.html create mode 100644 doc/html/tqtextistream-members.html create mode 100644 doc/html/tqtextistream.html create mode 100644 doc/html/tqtextostream-members.html create mode 100644 doc/html/tqtextostream.html create mode 100644 doc/html/tqtextstream-h.html create mode 100644 doc/html/tqtextstream-members.html create mode 100644 doc/html/tqtextstream.html create mode 100644 doc/html/tqtextview-h.html create mode 100644 doc/html/tqtextview-members.html create mode 100644 doc/html/tqtextview.html delete mode 120000 include/ntqtextbrowser.h delete mode 120000 include/ntqtextcodec.h delete mode 120000 include/ntqtextcodecfactory.h delete mode 120000 include/ntqtextcodecplugin.h delete mode 120000 include/ntqtextedit.h delete mode 120000 include/ntqtextstream.h delete mode 120000 include/ntqtextview.h delete mode 120000 include/private/qtextcodecinterface_p.h delete mode 120000 include/private/qtextengine_p.h delete mode 120000 include/private/qtextlayout_p.h create mode 120000 include/private/tqtextcodecinterface_p.h create mode 120000 include/private/tqtextengine_p.h create mode 120000 include/private/tqtextlayout_p.h create mode 120000 include/tqtextbrowser.h create mode 120000 include/tqtextcodec.h create mode 120000 include/tqtextcodecfactory.h create mode 120000 include/tqtextcodecplugin.h create mode 120000 include/tqtextedit.h create mode 120000 include/tqtextstream.h create mode 120000 include/tqtextview.h delete mode 100644 src/codecs/ntqtextcodec.h delete mode 100644 src/codecs/ntqtextcodecfactory.h delete mode 100644 src/codecs/ntqtextcodecplugin.h delete mode 100644 src/codecs/qtextcodec.cpp delete mode 100644 src/codecs/qtextcodecfactory.cpp delete mode 100644 src/codecs/qtextcodecinterface_p.h delete mode 100644 src/codecs/qtextcodecplugin.cpp create mode 100644 src/codecs/tqtextcodec.cpp create mode 100644 src/codecs/tqtextcodec.h create mode 100644 src/codecs/tqtextcodecfactory.cpp create mode 100644 src/codecs/tqtextcodecfactory.h create mode 100644 src/codecs/tqtextcodecinterface_p.h create mode 100644 src/codecs/tqtextcodecplugin.cpp create mode 100644 src/codecs/tqtextcodecplugin.h delete mode 100644 src/kernel/qtextengine.cpp delete mode 100644 src/kernel/qtextengine_p.h delete mode 100644 src/kernel/qtextengine_unix.cpp delete mode 100644 src/kernel/qtextlayout.cpp delete mode 100644 src/kernel/qtextlayout_p.h create mode 100644 src/kernel/tqtextengine.cpp create mode 100644 src/kernel/tqtextengine_p.h create mode 100644 src/kernel/tqtextengine_unix.cpp create mode 100644 src/kernel/tqtextlayout.cpp create mode 100644 src/kernel/tqtextlayout_p.h delete mode 100644 src/tools/ntqtextstream.h delete mode 100644 src/tools/qtextstream.cpp create mode 100644 src/tools/tqtextstream.cpp create mode 100644 src/tools/tqtextstream.h delete mode 100644 src/widgets/ntqtextbrowser.h delete mode 100644 src/widgets/ntqtextedit.h delete mode 100644 src/widgets/ntqtextview.h delete mode 100644 src/widgets/qtextbrowser.cpp delete mode 100644 src/widgets/qtextedit.cpp delete mode 100644 src/widgets/qtextview.cpp create mode 100644 src/widgets/tqtextbrowser.cpp create mode 100644 src/widgets/tqtextbrowser.h create mode 100644 src/widgets/tqtextedit.cpp create mode 100644 src/widgets/tqtextedit.h create mode 100644 src/widgets/tqtextview.cpp create mode 100644 src/widgets/tqtextview.h diff --git a/ChangeLog.immodule b/ChangeLog.immodule index 872cb2fa..42a2c199 100644 --- a/ChangeLog.immodule +++ b/ChangeLog.immodule @@ -2001,7 +2001,7 @@ position and call QWidget::sendMouseEventToInputContext() - (drawContents): Follow API change - * src/widgets/ntqtextedit.h + * src/widgets/tqtextedit.h - (sendMouseEventToInputContext): New function * src/widgets/qtextedit.cpp - (QTextEditPrivate::composeMode): New function diff --git a/doc/application-walkthrough.doc b/doc/application-walkthrough.doc index 5c652e5f..d7afbc1e 100644 --- a/doc/application-walkthrough.doc +++ b/doc/application-walkthrough.doc @@ -60,10 +60,10 @@ Here's the header file in full: \include application/application.h It declares a class that inherits \l QMainWindow, with slots and private -variables. The class pre-declaration of \l QTextEdit at the beginning +variables. The class pre-declaration of \l TQTextEdit at the beginning (instead of an include) helps to speed up compilation. With this trick, \c{make depend} won't insist on recompiling every \c .cpp file that -includes \c application.h when \c ntqtextedit.h changes. +includes \c application.h when \c tqtextedit.h changes. \target simplemain \section1 A simple main() @@ -253,7 +253,7 @@ We create a \e Help menu, add it to the menu bar, and insert a few commands. Depending on the style it will appear on the right hand side of the menu bar or not. -\printline QTextEdit +\printline TQTextEdit \printline setFocus \printline setCentralWidget diff --git a/doc/changes.doc b/doc/changes.doc index ffe00caa..82c767f0 100644 --- a/doc/changes.doc +++ b/doc/changes.doc @@ -69,7 +69,7 @@ languages. Many new classes have been added to the TQt Library. Amongst them are classes that provide a docking architecture (\l{QDockArea}/\l{QDockWindow}), a powerful rich text editor -(QTextEdit), a class to store and access application settings +(TQTextEdit), a class to store and access application settings (QSettings) and a class to create and communicate with processes (QProcess). @@ -132,7 +132,7 @@ COM-like interface. QPluginManager makes it trivial to implement plugin support in applications. The TQt library is able to load additional styles, database drivers and text codecs from plugins which implement the relevant interfaces, e.g. QStyleFactoryInterface, -TQSqlDriverInterface or QTextCodecInterface. It is possible to remove +TQSqlDriverInterface or TQTextCodecInterface. It is possible to remove unused components from the TQt library, and easy to extend any application with 3rd party styles, database drivers or text codecs. @@ -163,7 +163,7 @@ optimized and extended to support editing. It allows editing formatted text with different fonts, colors, paragraph styles, tables and images. The editor supports different word wrap modes, command-based undo/redo, multiple selections, drag and drop, and many other -features. The new QTextEdit engine is highly optimized for proccesing +features. The new TQTextEdit engine is highly optimized for proccesing and displaying large documents quickly and efficiently. diff --git a/doc/classchart.doc b/doc/classchart.doc index 4339f313..bec0eb03 100644 --- a/doc/classchart.doc +++ b/doc/classchart.doc @@ -168,8 +168,8 @@ - - + + @@ -300,9 +300,9 @@ - - - + + + diff --git a/doc/dnd.doc b/doc/dnd.doc index 6da6117a..fe210fd4 100644 --- a/doc/dnd.doc +++ b/doc/dnd.doc @@ -52,14 +52,14 @@ mechanism. For drag and drop examples see (in increasing order of sophistication): \c qt/examples/iconview/simple_dd, \c qt/examples/dragdrop and \c qt/examples/fileiconview. See also the -QTextEdit widget source code. +TQTextEdit widget source code. \section1 Dragging To start a drag, for example in a \link TQWidget::mouseMoveEvent() mouse motion event\endlink, create an object of the QDragObject -subclass appropriate for your media, such as QTextDrag for text and +subclass appropriate for your media, such as TQTextDrag for text and TQImageDrag for images. Then call the drag() method. This is all you need for simple dragging of existing types. @@ -67,7 +67,7 @@ For example, to start dragging some text from a widget: \code void MyWidget::startDrag() { - QDragObject *d = new QTextDrag( myHighlightedText(), this ); + QDragObject *d = new TQTextDrag( myHighlightedText(), this ); d->dragCopy(); // do NOT delete d. } @@ -106,7 +106,7 @@ MyWidget::MyWidget(...) : void MyWidget::dragEnterEvent(QDragEnterEvent* event) { event->accept( - QTextDrag::canDecode(event) || + TQTextDrag::canDecode(event) || TQImageDrag::canDecode(event) ); } @@ -118,7 +118,7 @@ void MyWidget::dropEvent(QDropEvent* event) if ( TQImageDrag::decode(event, image) ) { insertImageAt(image, event->pos()); - } else if ( QTextDrag::decode(event, text) ) { + } else if ( TQTextDrag::decode(event, text) ) { insertTextAt(text, event->pos()); } } @@ -141,13 +141,13 @@ information on the clipboard: void MyWidget::copy() { QApplication::clipboard()->setData( - new QTextDrag(myHighlightedText()) ); + new TQTextDrag(myHighlightedText()) ); } void MyWidget::paste() { TQString text; - if ( QTextDrag::decode(QApplication::clipboard()->data(), text) ) + if ( TQTextDrag::decode(QApplication::clipboard()->data(), text) ) insertText( text ); } \endcode @@ -211,7 +211,7 @@ they can produce. This is achieved using \link http://www.rfc-editor.org/rfc/rfc1341.txt MIME types\endlink: the drag source provides a list of MIME types that it can produce (ordered from most appropriate to least appropriate), and the drop target chooses -which of those it can accept. For example, QTextDrag provides support +which of those it can accept. For example, TQTextDrag provides support for the "\c{text/plain}" MIME type (ordinary unformatted text), and the Unicode formats "\c{text/utf16}" and "\c{text/utf8}"; TQImageDrag provides for "\c{image/*}", where \c{*} is any image format that @@ -276,7 +276,7 @@ the drag start point and the drop event might look like this: \code void MyEditor::startDrag() { - QDragObject *d = new QTextDrag(myHighlightedText(), this); + QDragObject *d = new TQTextDrag(myHighlightedText(), this); if ( d->drag() && d->target() != this ) cutMyHighlightedText(); } @@ -285,7 +285,7 @@ void MyEditor::dropEvent(QDropEvent* event) { TQString text; - if ( QTextDrag::decode(event, text) ) { + if ( TQTextDrag::decode(event, text) ) { if ( event->source() == this && event->action() == QDropEvent::Move ) { // Careful not to tread on my own feet event->acceptAction(); @@ -305,7 +305,7 @@ an \e area is given for which the drag is accepted or ignored: \code void MyWidget::dragMoveEvent(QDragMoveEvent* event) { - if ( QTextDrag::canDecode(event) ) { + if ( TQTextDrag::canDecode(event) ) { MyCadItem* item = findMyItemAt(event->pos()); if ( item ) event->accept(); @@ -318,7 +318,7 @@ you promise the acceptance persists: \code void MyWidget::dragMoveEvent(QDragMoveEvent* event) { - if ( QTextDrag::canDecode(event) ) { + if ( TQTextDrag::canDecode(event) ) { MyCadItem* item = findMyItemAt(event->pos()); if ( item ) { QRect r = item->areaRelativeToMeClippedByAnythingInTheWay(); diff --git a/doc/features.doc b/doc/features.doc index 01c1f743..f1d89df1 100644 --- a/doc/features.doc +++ b/doc/features.doc @@ -198,10 +198,10 @@ The available options are: \i Disabling this disables all widgets except \l TQWidget. \i   \row \i TQT_NO_TEXTVIEW - \i HTML document viewing (\l QTextView) + \i HTML document viewing (\l TQTextView) \i TQT_NO_WIDGETS, TQT_NO_RICHTEXT \row \i TQT_NO_TEXTBROWSER - \i HTML document browsing (\l QTextBrowser) + \i HTML document browsing (\l TQTextBrowser) \i TQT_NO_TEXTVIEW \row \i TQT_NO_ICONVIEW \i Labelled icons (\l QIconView) diff --git a/doc/html/addressbook-example.html b/doc/html/addressbook-example.html index 957cc010..c61e3fb3 100644 --- a/doc/html/addressbook-example.html +++ b/doc/html/addressbook-example.html @@ -290,7 +290,7 @@ protected: #include <ntqlabel.h> #include <ntqcheckbox.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> ABCentralWidget::ABCentralWidget( TQWidget *parent, const char *name ) : TQWidget( parent, name ) @@ -313,8 +313,8 @@ void ABCentralWidget::save( const TQS if ( !f.open( IO_WriteOnly ) ) return; - TQTextStream t( &f ); - t.setEncoding(TQTextStream::UnicodeUTF8); + TQTextStream t( &f ); + t.setEncoding(TQTextStream::UnicodeUTF8); TQListViewItemIterator it( listView ); @@ -333,13 +333,13 @@ void ABCentralWidget::load( const TQS if ( !f.open( IO_ReadOnly ) ) return; - TQTextStream t( &f ); - t.setEncoding(TQTextStream::UnicodeUTF8); + TQTextStream t( &f ); + t.setEncoding(TQTextStream::UnicodeUTF8); - while ( !t.atEnd() ) { + while ( !t.atEnd() ) { TQListViewItem *item = new TQListViewItem( listView ); for ( unsigned int i = 0; i < 4; i++ ) - item->setText( i, t.readLine() ); + item->setText( i, t.readLine() ); } f.close(); diff --git a/doc/html/advanced.html b/doc/html/advanced.html index be9629a8..56b63c6b 100644 --- a/doc/html/advanced.html +++ b/doc/html/advanced.html @@ -59,7 +59,7 @@ body { background: #ffffff; color: black; } TQTableItemThe cell content for TQTable cells TQTableSelectionAccess to a selected area in a TQTable TQTabWidgetStack of tabbed widgets -TQTextBrowserRich text browser with hypertext navigation +TQTextBrowserRich text browser with hypertext navigation TQTimeEditTime editor TQToolBoxColumn of tabbed widget items diff --git a/doc/html/annotated.html b/doc/html/annotated.html index 4372d8b3..3a362ca5 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -377,16 +377,16 @@ body { background: #ffffff; color: black; } TQTableItemThe cell content for TQTable cells TQTableSelectionAccess to a selected area in a TQTable TQTabletEventParameters that describe a Tablet event -TQTextBrowserRich text browser with hypertext navigation -TQTextCodecConversion between text encodings -TQTextCodecPluginAbstract base for custom TQTextCodec plugins -TQTextDecoderState-based decoder -TQTextDragDrag and drop object for transferring plain and Unicode text -TQTextEditPowerful single-page rich text editor -TQTextEncoderState-based encoder -TQTextIStreamConvenience class for input streams -TQTextOStreamConvenience class for output streams -TQTextStreamBasic functions for reading and writing text using a TQIODevice +TQTextBrowserRich text browser with hypertext navigation +TQTextCodecConversion between text encodings +TQTextCodecPluginAbstract base for custom TQTextCodec plugins +TQTextDecoderState-based decoder +TQTextDragDrag and drop object for transferring plain and Unicode text +TQTextEditPowerful single-page rich text editor +TQTextEncoderState-based encoder +TQTextIStreamConvenience class for input streams +TQTextOStreamConvenience class for output streams +TQTextStreamBasic functions for reading and writing text using a TQIODevice TQThreadPlatform-independent threads TQThreadStoragePer-thread data storage TQTimeClock time functions diff --git a/doc/html/basic.html b/doc/html/basic.html index e0f96b44..3d09d177 100644 --- a/doc/html/basic.html +++ b/doc/html/basic.html @@ -54,7 +54,7 @@ widgets. TQSliderVertical or horizontal slider TQSpinBoxSpin box widget (spin button) TQSyntaxHighlighterBase class for implementing TQTextEdit syntax highlighters -TQTextEditPowerful single-page rich text editor +TQTextEditPowerful single-page rich text editor TQToolButtonQuick-access button to commands or options, usually used inside a TQToolBar diff --git a/doc/html/canvas-chart-example.html b/doc/html/canvas-chart-example.html index d2a40497..40379d95 100644 --- a/doc/html/canvas-chart-example.html +++ b/doc/html/canvas-chart-example.html @@ -144,8 +144,8 @@ private: }; -TQTextStream &operator<<( TQTextStream&, const Element& ); -TQTextStream &operator>>( TQTextStream&, Element& ); +TQTextStream &operator<<( TQTextStream&, const Element& ); +TQTextStream &operator>>( TQTextStream&, Element& ); #endif diff --git a/doc/html/chart-chartform_files-cpp.html b/doc/html/chart-chartform_files-cpp.html index 48705ab2..bbcb75b8 100644 --- a/doc/html/chart-chartform_files-cpp.html +++ b/doc/html/chart-chartform_files-cpp.html @@ -53,11 +53,11 @@ void ChartForm::load( const TQString< init(); // Make sure we have colours m_filename = filename; - TQTextStream ts( &file ); + TQTextStream ts( &file ); Element element; int errors = 0; int i = 0; - while ( !ts.eof() ) { + while ( !ts.eof() ) { ts >> element; if ( element.isValid() ) m_elements[i++] = element; @@ -103,7 +103,7 @@ void ChartForm::fileSave() arg( m_filename ), 2000 ); return; } - TQTextStream ts( &file ); + TQTextStream ts( &file ); for ( int i = 0; i < MAX_ELEMENTS; ++i ) if ( m_elements[i].isValid() ) ts << m_elements[i]; diff --git a/doc/html/chart-element-cpp.html b/doc/html/chart-element-cpp.html index 8851ba0b..3ee388b9 100644 --- a/doc/html/chart-element-cpp.html +++ b/doc/html/chart-element-cpp.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; }
#include "element.h"
 
 #include <tqstringlist.h>
-#include <ntqtextstream.h>
+#include <tqtextstream.h>
 
 const char FIELD_SEP = ':';
 const char PROPOINT_SEP = ';';
@@ -91,7 +91,7 @@ void Element::setProY( int index, double value )
 }
 
 
-TQTextStream &operator<<( TQTextStream &s, const Element &element )
+TQTextStream &operator<<( TQTextStream &s, const Element &element )
 {
     s << element.value() << FIELD_SEP
       << element.valueColor().name() << FIELD_SEP
@@ -109,9 +109,9 @@ TQTextStream &operator<<( TQTextStreamTQTextStream &s, Element &element )
+TQTextStream &operator>>( TQTextStream &s, Element &element )
 {
-    TQString data = s.readLine();
+    TQString data = s.readLine();
     element.setValue( Element::INVALID );
 
     int errors = 0;
diff --git a/doc/html/chart-element-h.html b/doc/html/chart-element-h.html
index b6959af6..70497a78 100644
--- a/doc/html/chart-element-h.html
+++ b/doc/html/chart-element-h.html
@@ -112,8 +112,8 @@ private:
 };
 
 
-TQTextStream &operator<<( TQTextStream&, const Element& );
-TQTextStream &operator>>( TQTextStream&, Element& );
+TQTextStream &operator<<( TQTextStream&, const Element& );
+TQTextStream &operator>>( TQTextStream&, Element& );
 
 #endif
 
diff --git a/doc/html/classchart.html b/doc/html/classchart.html index 364cc66d..e56ad71a 100644 --- a/doc/html/classchart.html +++ b/doc/html/classchart.html @@ -158,8 +158,8 @@ body { background: #ffffff; color: black; } - - + + @@ -290,9 +290,9 @@ body { background: #ffffff; color: black; } - - - + + + diff --git a/doc/html/classes.html b/doc/html/classes.html index 7ccd9b73..49869779 100644 --- a/doc/html/classes.html +++ b/doc/html/classes.html @@ -123,7 +123,7 @@ classes, see TQt's Main Classes. TQProcess -TQTextBrowser +TQTextBrowser TQAsciiCacheIterator @@ -134,7 +134,7 @@ classes, see TQt's Main Classes. TQProgressBar -TQTextCodec +TQTextCodec TQAsciiDict @@ -145,7 +145,7 @@ classes, see TQt's Main Classes. TQProgressDialog -TQTextCodecPlugin +TQTextCodecPlugin TQAsciiDictIterator @@ -156,7 +156,7 @@ classes, see TQt's Main Classes. TQPtrCollection -TQTextDecoder +TQTextDecoder TQAssistantClient @@ -167,7 +167,7 @@ classes, see TQt's Main Classes. TQPtrDict -TQTextDrag +TQTextDrag TQAxAggregated @@ -178,7 +178,7 @@ classes, see TQt's Main Classes. TQPtrDictIterator -TQTextEdit +TQTextEdit TQAxBase @@ -189,7 +189,7 @@ classes, see TQt's Main Classes. TQPtrList -TQTextEncoder +TQTextEncoder TQAxBindable @@ -200,7 +200,7 @@ classes, see TQt's Main Classes. TQPtrListIterator -TQTextIStream +TQTextIStream TQAxFactory @@ -211,7 +211,7 @@ classes, see TQt's Main Classes. TQPtrQueue -TQTextOStream +TQTextOStream TQAxObject @@ -222,7 +222,7 @@ classes, see TQt's Main Classes. TQPtrStack -TQTextStream +TQTextStream TQAxScript diff --git a/doc/html/clientserver-example.html b/doc/html/clientserver-example.html index b66a1f1e..d44930b6 100644 --- a/doc/html/clientserver-example.html +++ b/doc/html/clientserver-example.html @@ -59,10 +59,10 @@ specified. You can send single lines to the server. #include <ntqserversocket.h> #include <ntqapplication.h> #include <ntqvbox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqlabel.h> #include <ntqpushbutton.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <stdlib.h> @@ -97,9 +97,9 @@ signals: private slots: void readClient() { - TQTextStream ts( this ); + TQTextStream ts( this ); while ( canReadLine() ) { - TQString str = ts.readLine(); + TQString str = ts.readLine(); emit logText( tr("Read: '%1'\n").arg(str) ); ts << line << ": " << str << endl; @@ -165,7 +165,7 @@ public: ); TQLabel *lb = new TQLabel( itext, this ); lb->setAlignment( AlignHCenter ); - infoText = new TQTextView( this ); + infoText = new TQTextView( this ); TQPushButton *quit = new TQPushButton( tr("Quit") , this ); connect( server, TQ_SIGNAL(newConnect(ClientSocket*)), @@ -181,20 +181,20 @@ public: private slots: void newConnect( ClientSocket *s ) { - infoText->append( tr("New connection\n") ); + infoText->append( tr("New connection\n") ); connect( s, TQ_SIGNAL(logText(const TQString&)), - infoText, TQ_SLOT(append(const TQString&)) ); + infoText, TQ_SLOT(append(const TQString&)) ); connect( s, TQ_SIGNAL(connectionClosed()), TQ_SLOT(connectionClosed()) ); } void connectionClosed() { - infoText->append( tr("Client closed connection\n") ); + infoText->append( tr("Client closed connection\n") ); } private: - TQTextView *infoText; + TQTextView *infoText; }; @@ -226,11 +226,11 @@ int main( int argc, char** argv ) #include <ntqapplication.h> #include <ntqvbox.h> #include <ntqhbox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqlineedit.h> #include <ntqlabel.h> #include <ntqpushbutton.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> class Client : public TQVBox @@ -240,7 +240,7 @@ public: Client( const TQString &host, TQ_UINT16 port ) { // GUI layout - infoText = new TQTextView( this ); + infoText = new TQTextView( this ); TQHBox *hb = new TQHBox( this ); inputText = new TQLineEdit( hb ); TQPushButton *send = new TQPushButton( tr("Send") , hb ); @@ -263,7 +263,7 @@ public: TQ_SLOT(socketError(int)) ); // connect to the server - infoText->append( tr("Trying to connect to the server\n") ); + infoText->append( tr("Trying to connect to the server\n") ); socket->connectToHost( host, port ); } @@ -288,7 +288,7 @@ private slots: void sendToServer() { // write to the server - TQTextStream os(socket); + TQTextStream os(socket); os << inputText->text() << "\n"; inputText->setText( "" ); } @@ -297,33 +297,33 @@ private slots: { // read from the server while ( socket->canReadLine() ) { - infoText->append( socket->readLine() ); + infoText->append( socket->readLine() ); } } void socketConnected() { - infoText->append( tr("Connected to server\n") ); + infoText->append( tr("Connected to server\n") ); } void socketConnectionClosed() { - infoText->append( tr("Connection closed by the server\n") ); + infoText->append( tr("Connection closed by the server\n") ); } void socketClosed() { - infoText->append( tr("Connection closed\n") ); + infoText->append( tr("Connection closed\n") ); } void socketError( int e ) { - infoText->append( tr("Error number %1 occurred\n").arg(e) ); + infoText->append( tr("Error number %1 occurred\n").arg(e) ); } private: TQSocket *socket; - TQTextView *infoText; + TQTextView *infoText; TQLineEdit *inputText; }; diff --git a/doc/html/customlayout-example.html b/doc/html/customlayout-example.html index b8fb8bf6..6fa6ec4c 100644 --- a/doc/html/customlayout-example.html +++ b/doc/html/customlayout-example.html @@ -788,7 +788,7 @@ int main( int argc, char **argv ) large->addWidget( new TQPushButton( "North", wid ), BorderLayout::North ); large->addWidget( new TQPushButton( "West", wid ), BorderLayout::West ); TQMultiLineEdit* m = new TQMultiLineEdit( wid ); - m->setText( "Central\nWidget" ); + m->setText( "Central\nWidget" ); large->addWidget( m, BorderLayout::Center ); TQWidget *east1 = new TQPushButton( "East", wid ); large->addWidget( east1, BorderLayout::East ); diff --git a/doc/html/designer-manual-16.html b/doc/html/designer-manual-16.html index 884083ec..b59d75c1 100644 --- a/doc/html/designer-manual-16.html +++ b/doc/html/designer-manual-16.html @@ -371,7 +371,7 @@ body { background: #ffffff; color: black; }

widget

Widgets are used at multiple levels within a .ui file. The whole form itself is a widget, and it contains other widgets, usually within the context of layouts such as hboxes, vboxes and grids.

-

Below is an example of a complete .ui file. The form itself is a TQWidget with various non-default properties set. This widget contains a single hbox, which also has some non-default properties, and which contains a single TQTextBrowser widget.

+

Below is an example of a complete .ui file. The form itself is a TQWidget with various non-default properties set. This widget contains a single hbox, which also has some non-default properties, and which contains a single TQTextBrowser widget.

 <!DOCTYPE UI><UI version="3.1" stdsetdef="1">
 <class>WinIntroPage</class>
diff --git a/doc/html/designer-manual-3.html b/doc/html/designer-manual-3.html
index b21cc226..a4da7992 100644
--- a/doc/html/designer-manual-3.html
+++ b/doc/html/designer-manual-3.html
@@ -205,7 +205,7 @@ body { background: #ffffff; color: black; }
 

Click the viewActionGroup action group in the Action Editor, and drag it to the View menu; drop it on this menu (when the horizontal red line appears beneath the View menu). Because we dragged the action group, all its actions (in our case the viewTableAction and viewIconsAction) are added to the relevant menu. We'll also make the view actions available on the toolbar. Click the viewActionGroup once again, and drag it to the toolbar; drop it the right of the separator at the far right of the toolbar, and drop it on the toolbar's edge. (Again, a vertical red line will indicate the position.)

Don't forget that you can preview to see things in action with Ctrl+T, and to click File|Save (or press Ctrl+S) regularly! If you preview now you will find that if you click the view toolbar buttons and menu options that both the toolbar buttons and the menu items automatically stay in sync.

Creating the Main Widget

-

Most main-window style applications consist of a menu bar, a toolbar, a status bar and a central widget. We've already created a menu bar and toolbar, and since we've created a TQMainWindow (via the main window wizard), we also have a status bar. Widgets commonly used as an application's main widget are TQListView (which provides a tree view), TQTable and TQTextEdit. Since we want to provide our users with two different views of the same data, we'll use a TQWidgetStack as our main widget. The TQWidgetStack has no visual representation of its own; you place one or more widgets on each TQWidgetStack "page", as if each page was a form in its own right, and then provide the user with some mechanism for switching between pages. (This is similar in principle to using a TQTabWidget.) We want to provide our users with two views: a tabular view that lists colors and their names, and an icon-based view that shows color swatches. In our example we only place a single widget on each TQWidgetStack page; but this merely reflects the application's design -- we could have placed any number of widgets on each page.

+

Most main-window style applications consist of a menu bar, a toolbar, a status bar and a central widget. We've already created a menu bar and toolbar, and since we've created a TQMainWindow (via the main window wizard), we also have a status bar. Widgets commonly used as an application's main widget are TQListView (which provides a tree view), TQTable and TQTextEdit. Since we want to provide our users with two different views of the same data, we'll use a TQWidgetStack as our main widget. The TQWidgetStack has no visual representation of its own; you place one or more widgets on each TQWidgetStack "page", as if each page was a form in its own right, and then provide the user with some mechanism for switching between pages. (This is similar in principle to using a TQTabWidget.) We want to provide our users with two views: a tabular view that lists colors and their names, and an icon-based view that shows color swatches. In our example we only place a single widget on each TQWidgetStack page; but this merely reflects the application's design -- we could have placed any number of widgets on each page.

Click the Toolbox's Containers button, then click WidgetStack. Click approximately in the middle of the form to place the widget stack. Change the widget stack's name property to "colorWidgetStack".

@@ -632,10 +632,10 @@ body { background: #ffffff; color: black; } if ( file.open( IO_ReadOnly ) ) { statusBar()->message( TQString( "Loading '%1'..." ). arg( filename ) ); - TQTextStream stream( &file ); + TQTextStream stream( &file ); TQString line; - while ( ! stream.eof() ) { - line = stream.readLine(); + while ( ! stream.eof() ) { + line = stream.readLine(); if ( regex.search( line ) == -1 ) m_comments += line; else @@ -724,7 +724,7 @@ Captures: cap(1) cap(2) cap(3) cap(4) TQFile file( m_filename ); if ( file.open( IO_WriteOnly ) ) { - TQTextStream stream( &file ); + TQTextStream stream( &file ); if ( ! m_comments.isEmpty() ) stream << m_comments.join( "\n" ) << "\n"; TQMap<TQString,TQColor>::ConstIterator it; diff --git a/doc/html/dnd.html b/doc/html/dnd.html index 0fb3d295..08e41e13 100644 --- a/doc/html/dnd.html +++ b/doc/html/dnd.html @@ -59,18 +59,18 @@ mechanism.

For drag and drop examples see (in increasing order of sophistication): qt/examples/iconview/simple_dd, qt/examples/dragdrop and qt/examples/fileiconview. See also the -TQTextEdit widget source code. +TQTextEdit widget source code.

Dragging

To start a drag, for example in a mouse motion event, create an object of the TQDragObject -subclass appropriate for your media, such as TQTextDrag for text and +subclass appropriate for your media, such as TQTextDrag for text and TQImageDrag for images. Then call the drag() method. This is all you need for simple dragging of existing types.

For example, to start dragging some text from a widget:

 void MyWidget::startDrag()
 {
-    TQDragObject *d = new TQTextDrag( myHighlightedText(), this );
+    TQDragObject *d = new TQTextDrag( myHighlightedText(), this );
     d->dragCopy();
     // do NOT delete d.
 }
@@ -107,7 +107,7 @@ MyWidget::MyWidget(...) :
 void MyWidget::dragEnterEvent(TQDragEnterEvent* event)
 {
     event->accept(
-        TQTextDrag::canDecode(event) ||
+        TQTextDrag::canDecode(event) ||
         TQImageDrag::canDecode(event)
     );
 }
@@ -119,7 +119,7 @@ void MyWidget::dropEvent(TQDropEvent* event)
 
     if ( TQImageDrag::decode(event, image) ) {
         insertImageAt(image, event->pos());
-    } else if ( TQTextDrag::decode(event, text) ) {
+    } else if ( TQTextDrag::decode(event, text) ) {
         insertTextAt(text, event->pos());
     }
 }
@@ -143,13 +143,13 @@ information on the clipboard:
 void MyWidget::copy()
 {
     TQApplication::clipboard()->setData(
-        new TQTextDrag(myHighlightedText()) );
+        new TQTextDrag(myHighlightedText()) );
 }
 
 void MyWidget::paste()
 {
     TQString text;
-    if ( TQTextDrag::decode(TQApplication::clipboard()->data(), text) )
+    if ( TQTextDrag::decode(TQApplication::clipboard()->data(), text) )
         insertText( text );
 }
 
@@ -210,7 +210,7 @@ indicate to each other which data formats they can accept and which they can produce. This is achieved using MIME types: the drag source provides a list of MIME types that it can produce (ordered from most appropriate to least appropriate), and the drop target chooses -which of those it can accept. For example, TQTextDrag provides support +which of those it can accept. For example, TQTextDrag provides support for the "text/plain" MIME type (ordinary unformatted text), and the Unicode formats "text/utf16" and "text/utf8"; TQImageDrag provides for "image/*", where * is any image format that @@ -259,7 +259,7 @@ the drag start point and the drop event might look like this:

 void MyEditor::startDrag()
 {
-    TQDragObject *d = new TQTextDrag(myHighlightedText(), this);
+    TQDragObject *d = new TQTextDrag(myHighlightedText(), this);
     if ( d->drag() && d->target() != this )
         cutMyHighlightedText();
 }
@@ -268,7 +268,7 @@ void MyEditor::dropEvent(TQDropEvent* event)
 {
     TQString text;
 
-    if ( TQTextDrag::decode(event, text) ) {
+    if ( TQTextDrag::decode(event, text) ) {
         if ( event->source() == this && event->action() == TQDropEvent::Move ) {
             // Careful not to tread on my own feet
             event->acceptAction();
@@ -288,7 +288,7 @@ an area is given for which the drag is accepted or ignored:
 
 void MyWidget::dragMoveEvent(TQDragMoveEvent* event)
 {
-    if ( TQTextDrag::canDecode(event) ) {
+    if ( TQTextDrag::canDecode(event) ) {
         MyCadItem* item = findMyItemAt(event->pos());
         if ( item )
             event->accept();
@@ -302,7 +302,7 @@ you promise the acceptance persists:
 
 void MyWidget::dragMoveEvent(TQDragMoveEvent* event)
 {
-    if ( TQTextDrag::canDecode(event) ) {
+    if ( TQTextDrag::canDecode(event) ) {
         MyCadItem* item = findMyItemAt(event->pos());
         if ( item ) {
             TQRect r = item->areaRelativeToMeClippedByAnythingInTheWay();
diff --git a/doc/html/draganddrop.html b/doc/html/draganddrop.html
index abc15b81..eacda92b 100644
--- a/doc/html/draganddrop.html
+++ b/doc/html/draganddrop.html
@@ -49,7 +49,7 @@ TQt.
 TQMacMimeMaps open-standard MIME to Mac flavors
 TQMimeSourceAbstraction of objects which provide formatted data of a certain MIME type
 TQStoredDragSimple stored-value drag object for arbitrary MIME data
-TQTextDragDrag and drop object for transferring plain and Unicode text
+TQTextDragDrag and drop object for transferring plain and Unicode text
 TQUriDragDrag object for a list of URI references
 TQWindowsMimeMaps open-standard MIME to Window Clipboard formats
 
diff --git a/doc/html/emb-features.html b/doc/html/emb-features.html
index 035040ab..a35244be 100644
--- a/doc/html/emb-features.html
+++ b/doc/html/emb-features.html
@@ -175,10 +175,10 @@ translation (TQWMatrix)
 Disabling this disables all widgets except TQWidget.
  
  TQT_NO_TEXTVIEW
-HTML document viewing (TQTextView)
+HTML document viewing (TQTextView)
 TQT_NO_WIDGETS, TQT_NO_RICHTEXT
  TQT_NO_TEXTBROWSER
-HTML document browsing (TQTextBrowser)
+HTML document browsing (TQTextBrowser)
 TQT_NO_TEXTVIEW
  TQT_NO_ICONVIEW
 Labelled icons (TQIconView)
diff --git a/doc/html/functions.html b/doc/html/functions.html
index df4f3ff5..9dac6979 100644
--- a/doc/html/functions.html
+++ b/doc/html/functions.html
@@ -132,7 +132,7 @@ abort:
  TQMessageBox TQSimpleRichText TQWidget
  • advance: TQCanvas TQCanvasItem TQCanvasSprite
  • afterSeek: TQSqlQuery
  • alignment: - TQGroupBox TQLabel TQLayoutItem TQLineEdit TQMultiLineEdit TQStyleSheetItem TQTableItem TQTextEdit
  • alignmentRect: + TQGroupBox TQLabel TQLayoutItem TQLineEdit TQMultiLineEdit TQStyleSheetItem TQTableItem TQTextEdit
  • alignmentRect: TQLayout
  • all: TQMacMime TQWindowsMime
  • allColumnsShowFocus: TQListView
  • allGray: @@ -145,8 +145,8 @@ abort: TQSessionManager
  • allowsInteraction: TQSessionManager
  • alpha: TQGLFormat
  • anchorAt: - TQSimpleRichText TQTextEdit
  • anchorClicked: - TQTextBrowser
  • anchorCol: + TQSimpleRichText TQTextEdit
  • anchorClicked: + TQTextBrowser
  • anchorCol: TQTableSelection
  • anchorRow: TQTableSelection
  • angleLength: TQCanvasEllipse
  • angleStart: @@ -155,7 +155,7 @@ abort: TQCanvasItem
  • answerRect: TQDragMoveEvent
  • appID: TQAxFactory
  • append: - TQCString TQIconDrag TQPtrList TQSqlCursor TQSqlIndex TQSqlRecord TQString TQTextEdit TQValueList TQValueVector TQXmlAttributes
  • appendChild: + TQCString TQIconDrag TQPtrList TQSqlCursor TQSqlIndex TQSqlRecord TQString TQTextEdit TQValueList TQValueVector TQXmlAttributes
  • appendChild: TQDomNode
  • appendData: TQDomCharacterData
  • applicationContext: TQMotif
  • applicationDirPath: @@ -216,7 +216,7 @@ abort: TQAssistantClient
  • at: TQBitArray TQIODevice TQMemArray TQPtrList TQPtrVector TQSocket TQSqlQuery TQSqlResult TQString TQValueList TQValueVector
  • atBeginning: TQMultiLineEdit
  • atEnd: - TQDataStream TQFile TQIODevice TQMultiLineEdit TQSocket TQTextStream
  • atFirst: + TQDataStream TQFile TQIODevice TQMultiLineEdit TQSocket TQTextStream
  • atFirst: TQAsciiCacheIterator TQCacheIterator TQIntCacheIterator TQPtrListIterator
  • atLast: TQAsciiCacheIterator TQCacheIterator TQIntCacheIterator TQPtrListIterator
  • attribute: TQDomElement
  • attributeDecl: @@ -234,7 +234,7 @@ abort: TQPushButton
  • autoDelete: TQAsciiDict TQCache TQDataTable TQDict TQIconFactory TQIntDict TQNetworkProtocol TQPtrCollection TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector
  • autoEdit: TQDataBrowser TQDataTable
  • autoFormatting: - TQTextEdit
  • autoMask: + TQTextEdit
  • autoMask: TQWidget
  • autoRaise: TQToolButton
  • autoRepeat: TQButton TQCheckBox TQPushButton TQRadioButton
  • autoReset: @@ -253,8 +253,8 @@ back: TQWidget
  • backgroundPixmap: TQCanvas
  • backspace: TQLineEdit TQMultiLineEdit
  • backward: - TQTextBrowser
  • backwardAvailable: - TQTextBrowser
  • base: + TQTextBrowser
  • backwardAvailable: + TQTextBrowser
  • base: TQColorGroup TQScreen
  • baseName: TQFileInfo
  • baseSize: TQWidget
  • beep: @@ -279,7 +279,7 @@ back: TQObject
  • blocking: TQSocketDevice
  • blue: TQColor
  • bold: - TQFont TQFontDatabase TQFontInfo TQTextEdit
  • bottom: + TQFont TQFontDatabase TQFontInfo TQTextEdit
  • bottom: TQDoubleValidator TQIntValidator TQRect
  • bottomDock: TQMainWindow
  • bottomEdge: TQCanvasSprite
  • bottomLeft: @@ -321,9 +321,9 @@ c: TQAxScript TQAxScriptManager
  • canCast: TQVariant
  • canConvert: TQMacMime TQWindowsMime
  • canDecode: - TQColorDrag TQIconDrag TQImageDrag TQTextDrag TQUriDrag
  • canDelete: + TQColorDrag TQIconDrag TQImageDrag TQTextDrag TQUriDrag
  • canDelete: TQSqlCursor
  • canEncode: - TQTextCodec
  • canInsert: + TQTextCodec
  • canInsert: TQSqlCursor
  • canReadLine: TQSocket
  • canReadLineStderr: TQProcess
  • canReadLineStdout: @@ -366,7 +366,7 @@ c: TQTabDialog TQTabWidget
  • changed: TQImageConsumer
  • channel: TQCopChannel
  • charAt: - TQTextEdit
  • charWidth: + TQTextEdit
  • charWidth: TQFontMetrics
  • characters: TQXmlContentHandler
  • checkConnectArgs: TQObject
  • checkConnection: @@ -396,7 +396,7 @@ c: TQDir
  • cleanText: TQSpinBox
  • cleanup: TQColor TQCursor TQFontManager
  • clear: - TQAccel TQAsciiCache TQAsciiDict TQAxBase TQCache TQClipboard TQComboBox TQDict TQDomNode TQIconView TQIntCache TQIntDict TQLabel TQLineEdit TQListBox TQListView TQMap TQMenuBar TQMenuData TQObjectCleanupHandler TQPixmapCache TQPopupMenu TQPtrCollection TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQSplashScreen TQSqlCursor TQSqlField TQSqlForm TQSqlRecord TQStatusBar TQTextEdit TQToolBar TQToolTip TQTranslator TQValueList TQValueVector TQVariant TQXmlAttributes
  • clearArguments: + TQAccel TQAsciiCache TQAsciiDict TQAxBase TQCache TQClipboard TQComboBox TQDict TQDomNode TQIconView TQIntCache TQIntDict TQLabel TQLineEdit TQListBox TQListView TQMap TQMenuBar TQMenuData TQObjectCleanupHandler TQPixmapCache TQPopupMenu TQPtrCollection TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQSplashScreen TQSqlCursor TQSqlField TQSqlForm TQSqlRecord TQStatusBar TQTextEdit TQToolBar TQToolTip TQTranslator TQValueList TQValueVector TQVariant TQXmlAttributes
  • clearArguments: TQProcess
  • clearBit: TQBitArray
  • clearCalibration: TQWSMouseHandler
  • clearCell: @@ -409,7 +409,7 @@ c: TQWidget
  • clearModified: TQLineEdit
  • clearOperationQueue: TQNetworkProtocol
  • clearParagraphBackground: - TQTextEdit
  • clearPendingCommands: + TQTextEdit
  • clearPendingCommands: TQFtp
  • clearPendingData: TQSocket
  • clearPendingRequests: TQHttp
  • clearSelection: @@ -417,7 +417,7 @@ c: TQComboBox TQLineEdit
  • clearValues: TQDataBrowser TQDataView TQSqlForm TQSqlRecord
  • clearWFlags: TQWidget
  • clicked: - TQButton TQButtonGroup TQCheckBox TQHeader TQIconView TQListBox TQListView TQPushButton TQRadioButton TQTable TQTextEdit TQWhatsThis
  • client: + TQButton TQButtonGroup TQCheckBox TQHeader TQIconView TQListBox TQListView TQPushButton TQRadioButton TQTable TQTextEdit TQWhatsThis
  • client: TQWSWindow
  • clientSite: TQAxBindable
  • clientWindows: TQWSServer
  • clipRegion: @@ -439,14 +439,14 @@ c: TQApplication
  • clut: TQScreen
  • cmd: TQPaintDevice
  • codec: - TQTextStream
  • codecForCStrings: - TQTextCodec
  • codecForContent: - TQTextCodec
  • codecForIndex: - TQTextCodec
  • codecForLocale: - TQTextCodec
  • codecForMib: - TQTextCodec
  • codecForName: - TQTextCodec
  • codecForTr: - TQTextCodec
  • col: + TQTextStream
  • codecForCStrings: + TQTextCodec
  • codecForContent: + TQTextCodec
  • codecForIndex: + TQTextCodec
  • codecForLocale: + TQTextCodec
  • codecForMib: + TQTextCodec
  • codecForName: + TQTextCodec
  • codecForTr: + TQTextCodec
  • col: TQTableItem
  • colSpacing: TQGridLayout
  • colSpan: TQTableItem
  • colStretch: @@ -454,7 +454,7 @@ c: TQListView
  • collidesWith: TQCanvasItem
  • collisions: TQCanvas TQCanvasItem
  • color: - TQBrush TQCanvasText TQColorGroup TQImage TQPalette TQPen TQStyleOption TQStyleSheetItem TQTextEdit
  • colorGroup: + TQBrush TQCanvasText TQColorGroup TQImage TQPalette TQPen TQStyleOption TQStyleSheetItem TQTextEdit
  • colorGroup: TQWidget
  • colorMode: TQPrinter
  • colorNames: TQColor
  • colorSpec: @@ -532,7 +532,7 @@ c: TQScrollView
  • contentsX: TQScrollView
  • contentsY: TQScrollView
  • context: - TQGLWidget TQSimpleRichText TQTextEdit TQTranslatorMessage
  • contextMenuEvent: + TQGLWidget TQSimpleRichText TQTextEdit TQTranslatorMessage
  • contextMenuEvent: TQWidget
  • contextMenuRequested: TQIconView TQListBox TQListView TQTable
  • contexts: TQStyleSheetItem
  • control: @@ -554,8 +554,8 @@ c: TQMacMime TQWindowsMime
  • convertorName: TQMacMime TQWindowsMime
  • coords: TQRect
  • copy: - TQBitArray TQCString TQImage TQLineEdit TQMemArray TQPalette TQPicture TQPointArray TQTextEdit TQUrlOperator
  • copyAvailable: - TQTextEdit
  • copyBlt: + TQBitArray TQCString TQImage TQLineEdit TQMemArray TQPalette TQPicture TQPointArray TQTextEdit TQUrlOperator
  • copyAvailable: + TQTextEdit
  • copyBlt: TQPixmap
  • cornerWidget: TQScrollView TQTabWidget
  • count: TQAccel TQAsciiCache TQAsciiCacheIterator TQAsciiDict TQAsciiDictIterator TQButtonGroup TQCache TQCacheIterator TQCanvasPixmapArray TQComboBox TQComboTableItem TQDict TQDictIterator TQDir TQDockArea TQDomNamedNodeMap TQDomNodeList TQFocusData TQHeader TQIconView TQIntCache TQIntCacheIterator TQIntDict TQIntDictIterator TQKeyEvent TQKeySequence TQListBox TQMap TQMemArray TQMenuData TQPtrCollection TQPtrDict TQPtrDictIterator TQPtrList TQPtrListIterator TQPtrQueue TQPtrStack TQPtrVector TQSqlForm TQSqlRecord TQTabBar TQTabWidget TQToolBox TQValueList TQValueVector TQXmlAttributes
  • countCf: @@ -578,15 +578,15 @@ c: TQDomDocument
  • createElementNS: TQDomDocument
  • createEntityReference: TQDomDocument
  • createForMib: - TQTextCodecPlugin
  • createForName: - TQTextCodecPlugin
  • createGfx: + TQTextCodecPlugin
  • createForName: + TQTextCodecPlugin
  • createGfx: TQScreen
  • createHeuristicMask: TQImage TQPixmap
  • createHostWindow: TQAxWidget
  • createObject: TQAxFactory
  • createObjectWrapper: TQAxFactory
  • createPixmap: TQIconFactory
  • createPopupMenu: - TQLineEdit TQTextEdit
  • createProcessingInstruction: + TQLineEdit TQTextEdit
  • createProcessingInstruction: TQDomDocument
  • createQuery: TQSqlDriver
  • createTextNode: TQDomDocument
  • createUuid: @@ -600,10 +600,10 @@ c: TQTable
  • currEditRow: TQTable
  • current: TQAsciiCacheIterator TQAsciiDictIterator TQCacheIterator TQDictIterator TQDir TQGLayoutIterator TQIntCacheIterator TQIntDictIterator TQLayoutIterator TQListViewItemIterator TQPtrDictIterator TQPtrList TQPtrListIterator TQPtrQueue TQPtrStack
  • currentAlignmentChanged: - TQTextEdit
  • currentAllocContext: + TQTextEdit
  • currentAllocContext: TQColor
  • currentChanged: TQDataBrowser TQDataTable TQIconView TQListBox TQListView TQTabDialog TQTabWidget TQTable TQToolBox
  • currentColorChanged: - TQTextEdit
  • currentColumn: + TQTextEdit
  • currentColumn: TQTable
  • currentCommand: TQFtp
  • currentContext: TQGLContext
  • currentDate: @@ -613,8 +613,8 @@ c: TQFtp
  • currentDirPath: TQDir
  • currentEdited: TQDataBrowser
  • currentFont: - TQTextEdit
  • currentFontChanged: - TQTextEdit
  • currentId: + TQTextEdit
  • currentFontChanged: + TQTextEdit
  • currentId: TQFtp TQHttp
  • currentIndex: TQToolBox
  • currentItem: TQComboBox TQComboTableItem TQIconView TQListBox TQListView TQToolBox
  • currentKey: @@ -633,7 +633,7 @@ c: TQThread
  • currentTime: TQTime
  • currentValueText: TQSpinBox
  • currentVerticalAlignmentChanged: - TQTextEdit
  • cursor: + TQTextEdit
  • cursor: TQWidget
  • cursorBackward: TQLineEdit
  • cursorChanged: TQDataBrowser TQDataTable
  • cursorDown: @@ -645,7 +645,7 @@ c: TQMultiLineEdit
  • cursorPos: TQIMEvent
  • cursorPosition: TQLineEdit
  • cursorPositionChanged: - TQTextEdit
  • cursorRight: + TQTextEdit
  • cursorRight: TQMultiLineEdit
  • cursorUp: TQMultiLineEdit
  • cursorWordBackward: TQLineEdit TQMultiLineEdit
  • cursorWordForward: @@ -655,7 +655,7 @@ c: TQObject
  • customWhatsThis: TQWidget
  • customize: TQMainWindow
  • cut: - TQLineEdit TQTextEdit
  • + TQLineEdit TQTextEdit
  • dark: TQColor TQColorGroup
  • data: TQClipboard TQCustomEvent TQDomCharacterData TQDomProcessingInstruction TQIconDragItem TQMapConstIterator TQMapIterator TQMemArray TQMimeSourceFactory TQNetworkProtocol TQPicture TQPtrVector TQSqlResult TQUrlOperator TQXmlInputSource
  • dataChanged: @@ -679,7 +679,7 @@ dark: TQFont
  • decimals: TQDoubleValidator
  • declHandler: TQXmlReader
  • decode: - TQColorDrag TQImageDecoder TQImageDrag TQImageFormat TQTextDrag TQUriDrag TQUrl
  • decodeLocalFiles: + TQColorDrag TQImageDecoder TQImageDrag TQImageFormat TQTextDrag TQUriDrag TQUrl
  • decodeLocalFiles: TQUriDrag
  • decodeName: TQFile
  • decodeToUnicodeUris: TQUriDrag
  • decoderFor: @@ -701,10 +701,10 @@ dark: TQStyleSheetItem
  • definesFontStrikeOut: TQStyleSheetItem
  • definesFontUnderline: TQStyleSheetItem
  • del: - TQDataBrowser TQLineEdit TQSqlCursor TQTextEdit
  • delay: + TQDataBrowser TQLineEdit TQSqlCursor TQTextEdit
  • delay: TQToolTipGroup
  • delayedCloseFinished: TQSocket
  • deleteAllCodecs: - TQTextCodec
  • deleteAllItems: + TQTextCodec
  • deleteAllItems: TQLayout
  • deleteCurrent: TQDataBrowser TQDataTable TQLayoutIterator
  • deleteData: TQDomCharacterData
  • deleteItem: @@ -725,7 +725,7 @@ dark: TQObject
  • det: TQWMatrix
  • detach: TQBitArray TQGLColormap TQIconSet TQImage TQMap TQMemArray TQPicture TQPixmap
  • device: - TQDataStream TQGLContext TQPainter TQTabletEvent TQTextStream
  • deviceHeight: + TQDataStream TQGLContext TQPainter TQTabletEvent TQTextStream
  • deviceHeight: TQScreen
  • deviceIsPixmap: TQGLContext
  • deviceWidth: TQScreen
  • dialMoved: @@ -759,7 +759,7 @@ dark: TQLineEdit
  • doAutoScroll: TQIconView TQListView
  • doDefaultAction: TQAccessibleInterface
  • doKeyboardAction: - TQTextEdit
  • doLayout: + TQTextEdit
  • doLayout: TQListBox
  • docName: TQPrinter
  • dock: TQDockWindow
  • dockWindowList: @@ -769,14 +769,14 @@ dark: TQMainWindow
  • doctype: TQDomDocument
  • documentElement: TQDomDocument
  • documentTitle: - TQTextEdit
  • done: + TQTextEdit
  • done: TQDialog TQFtp TQHttp
  • doneCurrent: TQGLContext TQGLWidget
  • dotsPerMeterX: TQImage
  • dotsPerMeterY: TQImage
  • doubleBuffer: TQGLFormat TQGLWidget
  • doubleClickInterval: TQApplication
  • doubleClicked: - TQIconView TQListBox TQListView TQTable TQTextEdit
  • downRect: + TQIconView TQListBox TQListView TQTable TQTextEdit
  • downRect: TQSpinBox
  • drag: TQDragObject
  • dragAutoScroll: TQScrollView
  • dragCopy: @@ -883,7 +883,7 @@ echoMode: TQPtrQueue
  • ensureCellVisible: TQGridView TQTable
  • ensureCurrentVisible: TQListBox
  • ensureCursorVisible: - TQTextEdit
  • ensureItemVisible: + TQTextEdit
  • ensureItemVisible: TQIconView TQListView
  • ensureVisible: TQScrollView
  • enterAllocContext: TQColor
  • enterEvent: @@ -935,7 +935,7 @@ echoMode: falseText: TQDataTable
  • families: TQFontDatabase
  • family: - TQFont TQFontInfo TQTextEdit
  • fatalError: + TQFont TQFontInfo TQTextEdit
  • fatalError: TQXmlErrorHandler
  • feature: TQXmlReader
  • featureList: TQAxFactory
  • fetch: @@ -954,11 +954,11 @@ falseText: TQDir TQFileInfo TQMimeSourceFactory
  • fileSelected: TQFileDialog
  • filesSelected: TQFileDialog
  • fill: - TQBitArray TQCString TQImage TQMemArray TQPixmap TQPtrVector TQString TQTextStream
  • fillRect: + TQBitArray TQCString TQImage TQMemArray TQPixmap TQPtrVector TQString TQTextStream
  • fillRect: TQPainter
  • filter: TQDataBrowser TQDataTable TQDir TQSqlCursor TQWSInputMethod
  • filterSelected: TQFileDialog
  • find: - TQAsciiCache TQAsciiDict TQButtonGroup TQCString TQCache TQDataTable TQDict TQGLColormap TQIntCache TQIntDict TQMap TQMemArray TQPixmapCache TQPtrDict TQPtrList TQPtrVector TQSqlRecordInfo TQString TQTextEdit TQValueList TQWidget
  • findFirstVisibleItem: + TQAsciiCache TQAsciiDict TQButtonGroup TQCString TQCache TQDataTable TQDict TQGLColormap TQIntCache TQIntDict TQMap TQMemArray TQPixmapCache TQPtrDict TQPtrList TQPtrVector TQSqlRecordInfo TQString TQTextEdit TQValueList TQWidget
  • findFirstVisibleItem: TQIconView
  • findIndex: TQValueList
  • findItem: TQIconView TQListBox TQListView TQMenuData
  • findKey: @@ -983,7 +983,7 @@ falseText: TQDockWindow
  • fixedPitch: TQFont TQFontInfo
  • fixup: TQValidator
  • flags: - TQIODevice TQTextStream
  • flavor: + TQIODevice TQTextStream
  • flavor: TQMacMime
  • flavorFor: TQMacMime
  • flavorToMime: TQMacMime
  • flush: @@ -991,7 +991,7 @@ falseText: TQApplication
  • focusData: TQWidget
  • focusInEvent: TQWidget
  • focusNextPrevChild: - TQTextEdit TQWidget
  • focusOutEvent: + TQTextEdit TQWidget
  • focusOutEvent: TQWidget
  • focusPolicy: TQWidget
  • focusProxy: TQWidget
  • focusRectPolicy: @@ -1015,8 +1015,8 @@ falseText: TQDropEvent TQGLContext TQGLWidget TQImageDecoder TQImageIO TQMimeSource
  • formatName: TQImageDecoder TQImageFormatType
  • formatValue: TQSqlDriver
  • forward: - TQTextBrowser
  • forwardAvailable: - TQTextBrowser
  • frame: + TQTextBrowser
  • forwardAvailable: + TQTextBrowser
  • frame: TQCanvasSprite TQLineEdit
  • frameBuffer: TQDirectPainter
  • frameChanged: TQFrame
  • frameCount: @@ -1044,7 +1044,7 @@ falseText: TQDate TQDateTime TQFont TQTime
  • fromStringList: TQSqlIndex
  • fromUcs2: TQString
  • fromUnicode: - TQHebrewCodec TQTextCodec TQTextEncoder
  • fromUtf8: + TQHebrewCodec TQTextCodec TQTextEncoder
  • fromUtf8: TQString
  • front: TQValueList TQValueVector
  • fullPage: TQPrinter
  • fullSpan: @@ -1057,7 +1057,7 @@ gamma: TQLayoutItem TQWidget
  • get: TQFontManager TQFtp TQHttp TQUrlOperator
  • getColor: TQColorDialog
  • getCursorPosition: - TQTextEdit
  • getDouble: + TQTextEdit
  • getDouble: TQInputDialog
  • getExistingDirectory: TQFileDialog
  • getFirst: TQPtrList
  • getFont: @@ -1081,7 +1081,7 @@ gamma: TQColor
  • getRgba: TQColorDialog
  • getSaveFileName: TQFileDialog
  • getSelection: - TQTextEdit
  • getText: + TQTextEdit
  • getText: TQInputDialog
  • getURL: TQNPInstance
  • getURLNotify: TQNPInstance
  • getValidRect: @@ -1158,7 +1158,7 @@ hScrollBarMode: TQXmlReader
  • hasRef: TQUrl
  • hasScaledContents: TQLabel
  • hasSelectedText: - TQLineEdit TQTextEdit
  • hasStaticBackground: + TQLineEdit TQTextEdit
  • hasStaticBackground: TQScrollView
  • hasStockEvents: TQAxFactory
  • hasUser: TQUrl
  • hasViewXForm: @@ -1170,14 +1170,14 @@ hScrollBarMode: TQStyleOption
  • headerWidth: TQHeader
  • height: TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQWidget
  • heightForWidth: - TQBoxLayout TQGridLayout TQLayoutItem TQMenuBar TQTextEdit TQWidget
  • heightMM: + TQBoxLayout TQGridLayout TQLayoutItem TQMenuBar TQTextEdit TQWidget
  • heightMM: TQPaintDeviceMetrics
  • help: TQWizard
  • helpButton: TQWizard
  • helpButtonPressed: TQTabDialog
  • helpClicked: TQWizard
  • heuristicContentMatch: - TQTextCodec
  • heuristicNameMatch: - TQTextCodec
  • hide: + TQTextCodec
  • heuristicNameMatch: + TQTextCodec
  • hide: TQCanvasItem TQMenuBar TQToolTip TQWSWindow TQWidget
  • hideColumn: TQListView TQTable
  • hideEvent: TQScrollBar TQWidget
  • hideOrShow: @@ -1186,10 +1186,10 @@ hScrollBarMode: TQObject
  • highlight: TQColorGroup
  • highlightParagraph: TQSyntaxHighlighter
  • highlighted: - TQComboBox TQListBox TQMenuBar TQPopupMenu TQTextBrowser
  • highlightedText: + TQComboBox TQListBox TQMenuBar TQPopupMenu TQTextBrowser
  • highlightedText: TQColorGroup
  • hitButton: TQButton
  • home: - TQDir TQFocusData TQLineEdit TQMultiLineEdit TQTextBrowser
  • homeDirPath: + TQDir TQFocusData TQLineEdit TQMultiLineEdit TQTextBrowser
  • homeDirPath: TQDir
  • horData: TQSizePolicy
  • horStretch: TQSizePolicy
  • horizontalAlignment: @@ -1253,10 +1253,10 @@ icon: TQImage
  • inputFormats: TQImage TQImageDecoder TQImageIO
  • inputMask: TQLineEdit
  • insert: - TQAsciiCache TQAsciiDict TQButtonGroup TQCString TQCache TQDataBrowser TQDict TQIntCache TQIntDict TQLineEdit TQMap TQPixmapCache TQPtrDict TQPtrList TQPtrVector TQSqlCursor TQSqlForm TQSqlPropertyMap TQSqlRecord TQString TQTextEdit TQTranslator TQValueList TQValueVector
  • insertAfter: + TQAsciiCache TQAsciiDict TQButtonGroup TQCString TQCache TQDataBrowser TQDict TQIntCache TQIntDict TQLineEdit TQMap TQPixmapCache TQPtrDict TQPtrList TQPtrVector TQSqlCursor TQSqlForm TQSqlPropertyMap TQSqlRecord TQString TQTextEdit TQTranslator TQValueList TQValueVector
  • insertAfter: TQDomNode
  • insertAndMark: TQMultiLineEdit
  • insertAt: - TQMultiLineEdit TQTextEdit
  • insertBefore: + TQMultiLineEdit TQTextEdit
  • insertBefore: TQDomNode
  • insertChild: TQObject
  • insertColumns: TQTable
  • insertCurrent: @@ -1267,7 +1267,7 @@ icon: TQBoxLayout
  • insertLine: TQMultiLineEdit
  • insertPage: TQWizard
  • insertParagraph: - TQTextEdit
  • insertRows: + TQTextEdit
  • insertRows: TQTable
  • insertSearchPath: TQSettings
  • insertSeparator: TQMenuBar TQMenuData TQPopupMenu
  • insertSpacing: @@ -1404,7 +1404,7 @@ icon: TQWidget
  • isMinimized: TQWidget
  • isModal: TQDialog TQWidget
  • isModified: - TQLineEdit TQTextEdit
  • isMovingEnabled: + TQLineEdit TQTextEdit
  • isMovingEnabled: TQDockWindow TQHeader
  • isNotation: TQDomNode TQDomNotation
  • isNull: TQAxBase TQCString TQChar TQDate TQDateTime TQDomImplementation TQDomNode TQGuardedPtr TQHostAddress TQIconSet TQImage TQMemArray TQMovie TQPicture TQPixmap TQPoint TQPtrVector TQRect TQRegion TQSize TQSqlCursor TQSqlField TQSqlQuery TQSqlRecord TQSqlResult TQString TQTime TQUuid TQVariant
  • isNumber: @@ -1413,7 +1413,7 @@ icon: TQAssistantClient TQIODevice TQListView TQListViewItem TQSqlDatabase TQSqlDriver
  • isOpenError: TQSqlDatabase TQSqlDriver
  • isOptionEnabled: TQPrinter
  • isOverwriteMode: - TQTextEdit
  • isPartiallyObscured: + TQTextEdit
  • isPartiallyObscured: TQWSWindow
  • isPhase2: TQSessionManager
  • isPopup: TQWidget
  • isPrint: @@ -1424,10 +1424,10 @@ icon: TQPixmap
  • isRadioButtonExclusive: TQButtonGroup
  • isRaw: TQIODevice
  • isReadOnly: - TQDataBrowser TQLineEdit TQSqlCursor TQSqlField TQTable TQTextEdit
  • isReadWrite: + TQDataBrowser TQLineEdit TQSqlCursor TQSqlField TQTable TQTextEdit
  • isReadWrite: TQIODevice
  • isReadable: TQDir TQFileInfo TQIODevice TQUrlInfo
  • isRedoAvailable: - TQLineEdit TQTextEdit
  • isRegistered: + TQLineEdit TQTextEdit
  • isRegistered: TQCopChannel
  • isRelative: TQDir TQFileInfo
  • isRelativePath: TQDir
  • isRelativeUrl: @@ -1474,8 +1474,8 @@ icon: TQSqlFieldInfo
  • isTrimmed: TQSqlCursor
  • isTristate: TQCheckBox TQCheckListItem
  • isUndoAvailable: - TQLineEdit TQTextEdit
  • isUndoRedoEnabled: - TQTextEdit
  • isUpdatesEnabled: + TQLineEdit TQTextEdit
  • isUndoRedoEnabled: + TQTextEdit
  • isUpdatesEnabled: TQWidget
  • isValid: TQAccessibleInterface TQAxScriptEngine TQCanvasPixmapArray TQCanvasPolygonalItem TQColor TQDate TQDateTime TQGLContext TQGLWidget TQHttpHeader TQRect TQRegExp TQSize TQSocketDevice TQSqlQuery TQSqlResult TQTime TQUrl TQUrlInfo TQVariant
  • isVerticalSliderPressed: TQScrollView
  • isVerticallyStretchable: @@ -1486,7 +1486,7 @@ icon: TQObject
  • isWorking: TQDns
  • isWritable: TQFileInfo TQIODevice TQUrlInfo
  • italic: - TQFont TQFontDatabase TQFontInfo TQTextEdit
  • item: + TQFont TQFontDatabase TQFontInfo TQTextEdit
  • item: TQDomNamedNodeMap TQDomNodeList TQListBox TQStyleSheet TQTable TQToolBox
  • itemAbove: TQListViewItem
  • itemAt: TQListBox TQListView
  • itemBelow: @@ -1516,7 +1516,7 @@ join: key: TQAccel TQFont TQIconViewItem TQKeyEvent TQListViewItem TQMapConstIterator TQMapIterator TQTableItem
  • keyMap: TQWSServer
  • keyPressEvent: - TQLineEdit TQTextBrowser TQTextEdit TQWidget
  • keyReleaseEvent: + TQLineEdit TQTextBrowser TQTextEdit TQWidget
  • keyReleaseEvent: TQWidget
  • keyToValue: TQMetaProperty
  • keyboardFocusTab: TQTabBar
  • keyboardGrabber: @@ -1566,7 +1566,7 @@ label: TQCanvasSprite
  • leftJustify: TQCString TQString
  • leftMargin: TQScrollView
  • length: - TQCString TQDomCharacterData TQDomNamedNodeMap TQDomNodeList TQSqlFieldInfo TQString TQTextEdit TQXmlAttributes
  • lessThan: + TQCString TQDomCharacterData TQDomNamedNodeMap TQDomNodeList TQSqlFieldInfo TQString TQTextEdit TQXmlAttributes
  • lessThan: TQUrlInfo
  • lexicalHandler: TQXmlReader
  • library: TQLibrary
  • libraryPaths: @@ -1576,18 +1576,18 @@ label: TQComboBox
  • lineLength: TQMultiLineEdit
  • lineNumber: TQXmlLocator TQXmlParseException
  • lineOfChar: - TQTextEdit
  • lineSpacing: + TQTextEdit
  • lineSpacing: TQFontMetrics
  • lineStep: TQDial TQDirectPainter TQRangeControl TQScrollBar TQSlider TQSpinBox
  • lineUp: TQDockArea
  • lineUpDockWindows: TQMainWindow
  • lineWidth: TQFontMetrics TQFrame TQStyleOption
  • lines: - TQTextEdit
  • linesOfParagraph: - TQTextEdit
  • linestep: + TQTextEdit
  • linesOfParagraph: + TQTextEdit
  • linestep: TQScreen
  • link: TQColorGroup
  • linkClicked: - TQTextBrowser
  • linkUnderline: - TQTextEdit
  • linkVisited: + TQTextBrowser
  • linkUnderline: + TQTextEdit
  • linkVisited: TQColorGroup
  • list: TQFtp
  • listBox: TQComboBox TQListBoxItem
  • listChildren: @@ -1598,15 +1598,15 @@ label: TQStyleOption
  • listen: TQSocketDevice
  • load: TQAxScript TQAxScriptManager TQImage TQLibrary TQPicture TQPixmap TQTranslator
  • loadCharmap: - TQTextCodec
  • loadCharmapFile: - TQTextCodec
  • loadFromData: + TQTextCodec
  • loadCharmapFile: + TQTextCodec
  • loadFromData: TQImage TQPixmap
  • loadImages: TQWidgetFactory
  • local8Bit: TQString
  • localData: TQThreadStorage
  • localFileToUri: TQUriDrag
  • localName: TQDomNode TQXmlAttributes
  • locale: - TQTextCodec
  • localeAwareCompare: + TQTextCodec
  • localeAwareCompare: TQString
  • lock: TQApplication TQMutex
  • locked: TQApplication TQMutex
  • logicalDpiX: @@ -1636,9 +1636,9 @@ m11: TQMimeSourceFactory
  • makeArc: TQPointArray
  • makeCurrent: TQGLContext TQGLWidget
  • makeDecoder: - TQTextCodec
  • makeEllipse: + TQTextCodec
  • makeEllipse: TQPointArray
  • makeEncoder: - TQTextCodec
  • makeOverlayCurrent: + TQTextCodec
  • makeOverlayCurrent: TQGLWidget
  • makeRowLayout: TQIconView
  • manager: TQWSServer
  • manhattanLength: @@ -1675,7 +1675,7 @@ m11: TQIconView
  • maxItemWidth: TQIconView TQListBox
  • maxLength: TQLineEdit
  • maxLogLines: - TQTextEdit
  • maxPage: + TQTextEdit
  • maxPage: TQPrinter
  • maxValue: TQDateEdit TQDial TQRangeControl TQScrollBar TQSlider TQSpinBox TQTimeEdit
  • maxWidth: TQFontMetrics
  • maximize: @@ -1704,16 +1704,16 @@ m11: TQAxFactory TQObject
  • method: TQHttpRequestHeader
  • metric: TQPicture TQPixmap TQWidget
  • mibEnum: - TQEucJpCodec TQTextCodec
  • mibEnums: - TQTextCodecPlugin
  • microFocusHint: + TQEucJpCodec TQTextCodec
  • mibEnums: + TQTextCodecPlugin
  • microFocusHint: TQWidget
  • mid: TQCString TQColorGroup TQString
  • midLineWidth: TQFrame TQStyleOption
  • midlight: TQColorGroup
  • mightBeRichText: TQStyleSheet
  • mimeFor: TQMacMime TQWindowsMime
  • mimeName: - TQEucJpCodec TQEucKrCodec TQHebrewCodec TQJisCodec TQSjisCodec TQTextCodec
  • mimeSourceFactory: - TQTextEdit
  • minLeftBearing: + TQEucJpCodec TQEucKrCodec TQHebrewCodec TQJisCodec TQSjisCodec TQTextCodec
  • mimeSourceFactory: + TQTextEdit
  • minLeftBearing: TQFontMetrics
  • minPage: TQPrinter
  • minRightBearing: TQFontMetrics
  • minValue: @@ -1733,7 +1733,7 @@ m11: TQPlatinumStyle
  • mkdir: TQDir TQFtp TQUrlOperator
  • mode: TQFileDialog TQIODevice TQLCDNumber TQNPInstance TQSqlCursor
  • modificationChanged: - TQTextEdit
  • month: + TQTextEdit
  • month: TQDate
  • motifWidget: TQMotifWidget
  • mouseButtonClicked: TQIconView TQListBox TQListView
  • mouseButtonPressed: @@ -1752,7 +1752,7 @@ m11: TQCanvasItem TQIconViewItem TQRect
  • moveCenter: TQRect
  • moveChild: TQScrollView
  • moveCursor: - TQTextEdit
  • moveDockWindow: + TQTextEdit
  • moveDockWindow: TQDockArea TQMainWindow
  • moveEvent: TQWidget
  • moveFocus: TQButtonGroup
  • moveItem: @@ -1774,12 +1774,12 @@ m11: TQListViewItem
  • mutex: TQMutexLocker
  • name: - TQColor TQDomAttr TQDomDocumentType TQFile TQLocale TQMetaProperty TQObject TQSqlCursor TQSqlField TQSqlFieldInfo TQSqlIndex TQStyleSheetItem TQTextCodec TQUrlInfo TQWSWindow
  • nameFilter: + TQColor TQDomAttr TQDomDocumentType TQFile TQLocale TQMetaProperty TQObject TQSqlCursor TQSqlField TQSqlFieldInfo TQSqlIndex TQStyleSheetItem TQTextCodec TQUrlInfo TQWSWindow
  • nameFilter: TQDir TQUrlOperator
  • nameToType: TQVariant
  • namedItem: TQDomNamedNodeMap TQDomNode
  • namedItemNS: TQDomNamedNodeMap
  • names: - TQTextCodecPlugin
  • namespaceURI: + TQTextCodecPlugin
  • namespaceURI: TQDomNode
  • navigate: TQAccessibleInterface
  • newChannel: TQWSServer
  • newChild: @@ -1893,13 +1893,13 @@ object: TQPoint TQSize
  • operator/=: TQPoint TQSize
  • operator<: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage TQUuid
  • operator<<: - TQBitArray TQBrush TQCString TQColor TQColorGroup TQCursor TQDataStream TQDate TQDateTime TQDockArea TQDomNode TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator<=: + TQBitArray TQBrush TQCString TQColor TQColorGroup TQCursor TQDataStream TQDate TQDateTime TQDockArea TQDomNode TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator<=: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage
  • operator=: TQAsciiCacheIterator TQAsciiDict TQBitArray TQBitVal TQBitmap TQBrush TQCString TQCacheIterator TQColor TQColorGroup TQCursor TQDeepCopy TQDict TQDir TQDomAttr TQDomCDATASection TQDomCharacterData TQDomComment TQDomDocument TQDomDocumentFragment TQDomDocumentType TQDomElement TQDomEntity TQDomEntityReference TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQDomNotation TQDomProcessingInstruction TQDomText TQFileInfo TQFont TQFontInfo TQFontMetrics TQGLColormap TQGuardedPtr TQHostAddress TQHttpHeader TQIconSet TQImage TQIntCacheIterator TQIntDict fnord TQKeySequence TQLayoutIterator TQListViewItemIterator TQLocale TQMap TQMemArray TQMovie TQObjectList TQObjectListIterator TQPair TQPalette TQPen TQPicture TQPixmap TQPointArray TQPtrDict TQPtrList TQPtrListIterator TQPtrQueue TQPtrStack TQPtrVector TQRegExp TQRegion TQSqlCursor TQSqlError TQSqlField TQSqlFieldInfo TQSqlIndex TQSqlQuery TQSqlRecord TQStrList TQString TQStyleSheetItem TQTranslatorMessage TQUrl TQUrlInfo TQUuid TQValueList TQValueVector TQVariant
  • operator==: TQBrush TQCString TQChar TQColor TQColorGroup TQDate TQDateTime TQDir TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQFont TQGuardedPtr TQHostAddress TQImage TQKeySequence TQMapConstIterator TQMapIterator TQMemArray TQPalette TQPen TQPoint TQPtrList TQPtrVector TQRect TQRegExp TQRegion TQSize TQSizePolicy TQSqlField TQSqlFieldInfo TQString TQTableSelection TQTime TQTranslatorMessage TQUrl TQUrlInfo TQUuid TQValueList TQValueListConstIterator TQValueListIterator TQValueVector TQVariant TQWMatrix
  • operator>: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage TQUuid
  • operator>=: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage
  • operator>>: - TQBitArray TQBrush TQCString TQColor TQCursor TQDataStream TQDate TQDateTime TQDockArea TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator[]: + TQBitArray TQBrush TQCString TQColor TQCursor TQDataStream TQDate TQDateTime TQDockArea TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator[]: TQAsciiCache TQAsciiDict TQBitArray TQCache TQDict TQDir TQIntCache TQIntDict TQKeySequence TQMap TQMemArray TQPtrDict TQPtrVector TQString TQValueList TQValueVector
  • operator^: TQBitArray TQRegion
  • operator^=: TQBitArray TQRegion
  • operator|: @@ -1959,13 +1959,13 @@ packImage: TQWidget
  • paletteChange: TQWidget
  • paletteForegroundColor: TQWidget
  • paper: - TQTextEdit
  • paperSource: + TQTextEdit
  • paperSource: TQPrinter
  • paragraphAt: - TQTextEdit
  • paragraphBackgroundColor: - TQTextEdit
  • paragraphLength: - TQTextEdit
  • paragraphRect: - TQTextEdit
  • paragraphs: - TQTextEdit
  • parameters: + TQTextEdit
  • paragraphBackgroundColor: + TQTextEdit
  • paragraphLength: + TQTextEdit
  • paragraphRect: + TQTextEdit
  • paragraphs: + TQTextEdit
  • parameters: TQImageIO
  • parent: TQListViewItem TQObject
  • parentNode: TQDomNode
  • parentWidget: @@ -1973,8 +1973,8 @@ packImage: TQUrl TQXmlReader TQXmlSimpleReader
  • parseContinue: TQXmlSimpleReader
  • password: TQSqlDatabase TQUrl
  • paste: - TQLineEdit TQTextEdit
  • pasteSubType: - TQTextEdit
  • path: + TQLineEdit TQTextEdit
  • pasteSubType: + TQTextEdit
  • path: TQDir TQHttpRequestHeader TQUrl
  • pattern: TQRegExp
  • pause: TQMovie
  • paused: @@ -2001,11 +2001,11 @@ packImage: TQMainWindow
  • place: TQDockWindow
  • placeChanged: TQDockWindow
  • placeCursor: - TQTextEdit
  • plane: + TQTextEdit
  • plane: TQGLFormat
  • play: TQPicture TQSound
  • point: TQPointArray
  • pointSize: - TQFont TQFontInfo TQTextEdit
  • pointSizeFloat: + TQFont TQFontInfo TQTextEdit
  • pointSizeFloat: TQFont
  • pointSizes: TQFontDatabase
  • points: TQCanvasPolygon
  • polish: @@ -2024,7 +2024,7 @@ packImage: TQHttp
  • postEvent: TQApplication
  • postURL: TQNPInstance
  • precision: - TQSqlFieldInfo TQTextStream
  • prefix: + TQSqlFieldInfo TQTextStream
  • prefix: TQDomNode TQSpinBox TQXmlNamespaceSupport
  • prefixes: TQXmlNamespaceSupport
  • prepare: TQSqlQuery
  • prepend: @@ -2151,7 +2151,7 @@ rBottom: TQFtp
  • rawMode: TQFont TQFontInfo
  • rawName: TQFont
  • read: - TQAsciiDict TQDict TQImageIO TQIntDict TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTextStream
  • readAll: + TQAsciiDict TQDict TQImageIO TQIntDict TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTextStream
  • readAll: TQFile TQFtp TQHttp TQIODevice
  • readBlock: TQFtp TQHttp TQIODevice TQSocket TQSocketDevice
  • readBoolEntry: TQSettings
  • readBufferSize: @@ -2162,14 +2162,14 @@ rBottom: TQSettings
  • readField: TQSqlForm
  • readFields: TQDataBrowser TQDataView TQSqlForm
  • readLine: - TQFile TQIODevice TQSocket TQTextStream
  • readLineStderr: + TQFile TQIODevice TQSocket TQTextStream
  • readLineStderr: TQProcess
  • readLineStdout: TQProcess
  • readLink: TQFileInfo
  • readListEntry: TQSettings
  • readNumEntry: TQSettings
  • readPixmaps: TQCanvasPixmapArray
  • readRawBytes: - TQDataStream TQTextStream
  • readStderr: + TQDataStream TQTextStream
  • readStderr: TQProcess
  • readStdout: TQProcess
  • ready: TQAsyncIO
  • readyRead: @@ -2190,8 +2190,8 @@ rBottom: TQRegion
  • red: TQColor
  • redirect: TQPainter
  • redo: - TQLineEdit TQTextEdit
  • redoAvailable: - TQTextEdit
  • ref: + TQLineEdit TQTextEdit
  • redoAvailable: + TQTextEdit
  • ref: TQString TQUrl
  • reformat: TQStatusBar
  • refresh: TQDataBrowser TQDataTable TQDataView TQDir TQFileInfo TQSplitter TQWSServer
  • regExp: @@ -2210,7 +2210,7 @@ rBottom: TQWidget
  • releaseMouse: TQWidget
  • released: TQButton TQButtonGroup TQCheckBox TQHeader TQPushButton TQRadioButton
  • reload: - TQTextBrowser
  • remove: + TQTextBrowser
  • remove: TQAsciiCache TQAsciiDict TQButtonGroup TQCString TQCache TQDict TQDir TQFile TQFtp TQIntCache TQIntDict TQLayout TQMap TQObjectCleanupHandler TQPixmapCache TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQSqlCursor TQSqlForm TQSqlPropertyMap TQSqlRecord TQString TQToolTip TQTranslator TQUrlOperator TQValueList TQWhatsThis
  • removeAttribute: TQDomElement
  • removeAttributeNS: TQDomElement
  • removeAttributeNode: @@ -2236,15 +2236,15 @@ rBottom: TQDomNamedNodeMap
  • removeNode: TQPtrList
  • removePage: TQTabDialog TQTabWidget TQWizard
  • removeParagraph: - TQTextEdit
  • removePostedEvents: + TQTextEdit
  • removePostedEvents: TQApplication
  • removeRef: TQPtrList
  • removeRenameBox: TQIconViewItem
  • removeRow: TQTable
  • removeRows: TQTable
  • removeSearchPath: TQSettings
  • removeSelectedText: - TQTextEdit
  • removeSelection: - TQTable TQTextEdit
  • removeSubstitution: + TQTextEdit
  • removeSelection: + TQTable TQTextEdit
  • removeSubstitution: TQFont
  • removeTab: TQTabBar
  • removeTabToolTip: TQTabWidget
  • removeTip: @@ -2261,7 +2261,7 @@ rBottom: TQGLWidget
  • repaint: TQIconViewItem TQListViewItem TQSplashScreen TQWidget
  • repaintCell: TQGridView
  • repaintChanged: - TQTextEdit
  • repaintContents: + TQTextEdit
  • repaintContents: TQScrollView
  • repaintItem: TQIconView TQListView
  • repaintScreen: TQDial
  • repaintSelectedItems: @@ -2282,7 +2282,7 @@ rBottom: TQGLContext
  • rereadDir: TQFileDialog
  • reserve: TQString TQValueVector
  • reset: - TQDataTable TQGLContext TQIODevice TQIconSet TQImage TQMetaProperty TQProgressBar TQProgressDialog TQSqlResult TQTextStream TQUrl TQWMatrix TQWSInputMethod TQXmlInputSource TQXmlNamespaceSupport
  • resetGroup: + TQDataTable TQGLContext TQIODevice TQIconSet TQImage TQMetaProperty TQProgressBar TQProgressDialog TQSqlResult TQTextStream TQUrl TQWMatrix TQWSInputMethod TQXmlInputSource TQXmlNamespaceSupport
  • resetGroup: TQSettings
  • resetInputContext: TQWidget
  • resetRawData: TQMemArray
  • resetReason: @@ -2312,7 +2312,7 @@ rBottom: TQDialog TQSqlQuery
  • resultsReady: TQDns
  • retune: TQCanvas
  • returnPressed: - TQIconView TQLineEdit TQListBox TQListView TQTextEdit
  • reverseLayout: + TQIconView TQLineEdit TQListBox TQListView TQTextEdit
  • reverseLayout: TQApplication
  • rewind: TQDataSource TQIODeviceSource
  • rewindable: TQDataSource TQIODeviceSource
  • rgb: @@ -2381,8 +2381,8 @@ sRect: TQWidget
  • scrollBarsEnabled: TQWorkspace
  • scrollBy: TQScrollView
  • scrollToAnchor: - TQTextEdit
  • scrollToBottom: - TQTextEdit
  • search: + TQTextEdit
  • scrollToBottom: + TQTextEdit
  • search: TQRegExp
  • searchRev: TQRegExp
  • second: TQTime
  • secsTo: @@ -2398,7 +2398,7 @@ sRect: TQNPStream
  • segmentStyle: TQLCDNumber
  • select: TQSqlCursor
  • selectAll: - TQFileDialog TQIconView TQLineEdit TQListBox TQListView TQSpinBox TQTextEdit
  • selectCells: + TQFileDialog TQIconView TQLineEdit TQListBox TQListView TQSpinBox TQTextEdit
  • selectCells: TQTable
  • selectColumn: TQTable
  • selectRow: TQTable
  • selectTab: @@ -2409,9 +2409,9 @@ sRect: TQFileDialog
  • selectedId: TQButtonGroup
  • selectedItem: TQListBox TQListView
  • selectedText: - TQLineEdit TQTextEdit
  • selection: + TQLineEdit TQTextEdit
  • selection: TQAccessibleInterface TQTable
  • selectionChanged: - TQClipboard TQIconView TQLineEdit TQListBox TQListView TQTable TQTextEdit
  • selectionLength: + TQClipboard TQIconView TQLineEdit TQListBox TQListView TQTable TQTextEdit
  • selectionLength: TQIMEvent
  • selectionMode: TQIconView TQListBox TQListView TQTable
  • selectionStart: TQLineEdit
  • selfMask: @@ -2444,7 +2444,7 @@ sRect: TQHostAddress
  • setAddressReusable: TQSocketDevice
  • setAdvancePeriod: TQCanvas
  • setAlignment: - TQGroupBox TQLabel TQLayoutItem TQLineEdit TQMultiLineEdit TQStyleSheetItem TQTextEdit
  • setAllChanged: + TQGroupBox TQLabel TQLayoutItem TQLineEdit TQMultiLineEdit TQStyleSheetItem TQTextEdit
  • setAllChanged: TQCanvas
  • setAllColumnsShowFocus: TQListView
  • setAlpha: TQGLFormat
  • setAlphaBuffer: @@ -2473,7 +2473,7 @@ sRect: TQPushButton
  • setAutoDelete: TQAsciiDict TQCache TQDataTable TQDict TQIconFactory TQIntDict TQNetworkProtocol TQPtrCollection TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector
  • setAutoEdit: TQDataBrowser TQDataTable
  • setAutoFormatting: - TQTextEdit
  • setAutoMask: + TQTextEdit
  • setAutoMask: TQWidget
  • setAutoRaise: TQToolButton
  • setAutoRepeat: TQButton TQCheckBox TQPushButton TQRadioButton
  • setAutoReset: @@ -2489,7 +2489,7 @@ sRect: TQLCDNumber
  • setBit: TQBitArray
  • setBlocking: TQSocketDevice
  • setBold: - TQFont TQTextEdit
  • setBottom: + TQFont TQTextEdit
  • setBottom: TQDoubleValidator TQIntValidator TQRect
  • setBottomItem: TQListBox
  • setBottomLeft: TQRect
  • setBottomRight: @@ -2529,15 +2529,15 @@ sRect: TQPainter
  • setClipping: TQPainter
  • setCloseMode: TQDockWindow
  • setCodec: - TQTextStream
  • setCodecForCStrings: - TQTextCodec
  • setCodecForLocale: - TQTextCodec
  • setCodecForTr: - TQTextCodec
  • setCol: + TQTextStream
  • setCodecForCStrings: + TQTextCodec
  • setCodecForLocale: + TQTextCodec
  • setCodecForTr: + TQTextCodec
  • setCol: TQTableItem
  • setColSpacing: TQGridLayout
  • setColStretch: TQGridLayout
  • setCollapsible: TQSplitter
  • setColor: - TQBrush TQCanvasText TQColorDrag TQColorGroup TQImage TQPalette TQPen TQStyleSheetItem TQTextEdit
  • setColorMode: + TQBrush TQCanvasText TQColorDrag TQColorGroup TQImage TQPalette TQPen TQStyleSheetItem TQTextEdit
  • setColorMode: TQPrinter
  • setColorSpec: TQApplication
  • setColormap: TQGLWidget
  • setColumn: @@ -2576,7 +2576,7 @@ sRect: TQPrinter
  • setCurrent: TQDir
  • setCurrentCell: TQTable
  • setCurrentFont: - TQTextEdit
  • setCurrentIndex: + TQTextEdit
  • setCurrentIndex: TQToolBox
  • setCurrentItem: TQComboBox TQComboTableItem TQIconView TQListBox TQListView TQToolBox
  • setCurrentPage: TQTabWidget
  • setCurrentTab: @@ -2585,7 +2585,7 @@ sRect: TQWidget
  • setCursorFlashTime: TQApplication
  • setCursorName: TQSqlIndex
  • setCursorPosition: - TQLineEdit TQMultiLineEdit TQTextEdit
  • setCursorVisible: + TQLineEdit TQMultiLineEdit TQTextEdit
  • setCursorVisible: TQWSServer
  • setCustomColor: TQColorDialog
  • setCustomHighlighting: TQListBoxItem
  • setDTDHandler: @@ -2619,7 +2619,7 @@ sRect: TQImageIO
  • setDesktopBackground: TQWSServer
  • setDesktopSettingsAware: TQApplication
  • setDevice: - TQDataStream TQTextStream
  • setDir: + TQDataStream TQTextStream
  • setDir: TQFileDialog TQUrlInfo
  • setDirectRendering: TQGLFormat
  • setDirection: TQBoxLayout
  • setDirty: @@ -2653,7 +2653,7 @@ sRect: TQAccel TQAction TQCanvasItem TQLayout TQListViewItem TQSocketNotifier TQTab TQTableItem TQToolTipGroup TQWidget
  • setEncodedData: TQStoredDrag
  • setEncodedPathAndQuery: TQUrl
  • setEncoding: - TQTextStream
  • setEncodingFunction: + TQTextStream
  • setEncodingFunction: TQFile
  • setEntityResolver: TQXmlReader
  • setEntries: TQGLColormap
  • setEntry: @@ -2670,7 +2670,7 @@ sRect: TQDialog
  • setExtensionType: TQMimeSourceFactory
  • setFalseText: TQDataTable
  • setFamily: - TQFont TQTextEdit
  • setFeature: + TQFont TQTextEdit
  • setFeature: TQXmlReader TQXmlSimpleReader
  • setFile: TQFileInfo TQUrlInfo
  • setFileName: TQImageIO TQUrl
  • setFileNames: @@ -2759,7 +2759,7 @@ sRect: TQComboBox
  • setInsideMargin: TQGroupBox
  • setInsideSpacing: TQGroupBox
  • setItalic: - TQFont TQTextEdit
  • setItem: + TQFont TQTextEdit
  • setItem: TQTable
  • setItemChecked: TQMenuData TQPopupMenu
  • setItemEnabled: TQAccel TQMenuBar TQMenuData TQPopupMenu TQToolBox
  • setItemIconSet: @@ -2791,7 +2791,7 @@ sRect: TQComboBox
  • setLineStep: TQDial TQScrollBar TQSlider TQSpinBox
  • setLineWidth: TQFrame
  • setLinkUnderline: - TQTextEdit
  • setListBox: + TQTextEdit
  • setListBox: TQComboBox
  • setListStyle: TQStyleSheetItem
  • setLocalData: TQThreadStorage
  • setLogicalFontSize: @@ -2812,7 +2812,7 @@ sRect: TQIconView
  • setMaxItemWidth: TQIconView
  • setMaxLength: TQLineEdit
  • setMaxLogLines: - TQTextEdit
  • setMaxValue: + TQTextEdit
  • setMaxValue: TQDateEdit TQDial TQRangeControl TQScrollBar TQSlider TQSpinBox TQTimeEdit
  • setMaxWindowRect: TQWSServer
  • setMaximumHeight: TQWidget
  • setMaximumSize: @@ -2823,7 +2823,7 @@ sRect: TQWSInputMethod
  • setMicroFocusHint: TQWidget
  • setMidLineWidth: TQFrame
  • setMimeSourceFactory: - TQTextEdit
  • setMinMax: + TQTextEdit
  • setMinMax: TQPrinter
  • setMinValue: TQDateEdit TQDial TQRangeControl TQScrollBar TQSlider TQSpinBox TQTimeEdit
  • setMinimal: TQRegExp
  • setMinimumDuration: @@ -2834,7 +2834,7 @@ sRect: TQTimeEdit
  • setModal: TQDialog
  • setMode: TQFileDialog TQIODevice TQLCDNumber TQScreen TQSqlCursor
  • setModified: - TQTextEdit
  • setMonth: + TQTextEdit
  • setMonth: TQDateEdit
  • setMouseTracking: TQWidget
  • setMovie: TQLabel
  • setMovingEnabled: @@ -2880,7 +2880,7 @@ sRect: TQFont
  • setOverrideCursor: TQApplication
  • setOverrideKeys: TQWSServer
  • setOverwriteMode: - TQTextEdit
  • setOwner: + TQTextEdit
  • setOwner: TQUrlInfo
  • setPageOrder: TQPrinter
  • setPageSize: TQPrinter
  • setPageStep: @@ -2889,9 +2889,9 @@ sRect: TQWidget
  • setPaletteBackgroundPixmap: TQWidget
  • setPaletteForegroundColor: TQWidget
  • setPaper: - TQTextEdit
  • setPaperSource: + TQTextEdit
  • setPaperSource: TQPrinter
  • setParagraphBackgroundColor: - TQTextEdit
  • setParameters: + TQTextEdit
  • setParameters: TQImageIO
  • setPassword: TQSqlDatabase TQUrl
  • setPath: TQDir TQSettings TQUrl
  • setPattern: @@ -2907,7 +2907,7 @@ sRect: TQIconViewItem
  • setPlane: TQGLFormat
  • setPoint: TQDropEvent TQPointArray
  • setPointSize: - TQFont TQTextEdit
  • setPointSizeFloat: + TQFont TQTextEdit
  • setPointSizeFloat: TQFont
  • setPoints: TQCanvasLine TQCanvasPolygon
  • setPopup: TQPushButton TQToolButton
  • setPopupDelay: @@ -2938,7 +2938,7 @@ sRect: TQFont
  • setRawName: TQFont
  • setReadBufferSize: TQSocket
  • setReadOnly: - TQDataBrowser TQLineEdit TQSqlField TQTable TQTextEdit
  • setReadable: + TQDataBrowser TQLineEdit TQSqlField TQTable TQTextEdit
  • setReadable: TQUrlInfo
  • setReason: TQFocusEvent
  • setReceiveBufferSize: TQSocketDevice
  • setRecord: @@ -2982,9 +2982,9 @@ sRect: TQIconViewItem TQListBoxItem TQListViewItem
  • setSelected: TQAccessibleInterface TQCanvasItem TQIconView TQIconViewItem TQListBox TQListView TQListViewItem
  • setSelectedFilter: TQFileDialog
  • setSelection: - TQFileDialog TQLineEdit TQTextEdit
  • setSelectionAnchor: + TQFileDialog TQLineEdit TQTextEdit
  • setSelectionAnchor: TQListView
  • setSelectionAttributes: - TQTextEdit
  • setSelectionMode: + TQTextEdit
  • setSelectionMode: TQIconView TQListBox TQListView TQTable
  • setSelfNesting: TQStyleSheetItem
  • setSendBufferSize: TQSocketDevice
  • setSeparator: @@ -3011,7 +3011,7 @@ sRect: TQHeader
  • setSortOrder: TQListView
  • setSorting: TQDir TQIconView TQListView TQTable
  • setSource: - TQTextBrowser
  • setSpacing: + TQTextBrowser
  • setSpacing: TQGrid TQHBox TQIconView TQLayout
  • setSpan: TQTableItem
  • setSpecialValueText: TQSpinBox
  • setSpeed: @@ -3036,28 +3036,28 @@ sRect: TQComboTableItem
  • setStyle: TQApplication TQBrush TQPen TQWidget
  • setStyleHint: TQFont
  • setStyleSheet: - TQTextEdit
  • setStyleStrategy: + TQTextEdit
  • setStyleStrategy: TQFont
  • setSubtype: - TQTextDrag
  • setSuffix: + TQTextDrag
  • setSuffix: TQSpinBox
  • setSupportsMargin: TQLayout
  • setSymLink: TQUrlInfo
  • setTabArray: TQPainter
  • setTabBar: TQTabDialog TQTabWidget
  • setTabChangesFocus: - TQTextEdit
  • setTabEnabled: + TQTextEdit
  • setTabEnabled: TQTabBar TQTabDialog TQTabWidget
  • setTabIconSet: TQTabWidget
  • setTabLabel: TQTabWidget
  • setTabOrder: TQWidget
  • setTabPosition: TQTabWidget
  • setTabShape: TQTabWidget
  • setTabStopWidth: - TQTextEdit
  • setTabStops: + TQTextEdit
  • setTabStops: TQPainter
  • setTabToolTip: TQTabWidget
  • setTagName: TQDomElement
  • setText: - TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQClipboard TQIconViewItem TQImage TQLabel TQLineEdit TQListBoxItem TQListViewItem TQMessageBox TQMimeSourceFactory TQPushButton TQRadioButton TQTab TQTable TQTableItem TQTextDrag TQTextEdit
  • setTextFlags: + TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQClipboard TQIconViewItem TQImage TQLabel TQLineEdit TQListBoxItem TQListViewItem TQMessageBox TQMimeSourceFactory TQPushButton TQRadioButton TQTab TQTable TQTableItem TQTextDrag TQTextEdit
  • setTextFlags: TQCanvasText
  • setTextFormat: - TQLabel TQMessageBox TQTextEdit
  • setTextLabel: + TQLabel TQMessageBox TQTextEdit
  • setTextLabel: TQToolButton
  • setTextPosition: TQToolButton
  • setTextRect: TQIconViewItem
  • setTickInterval: @@ -3089,9 +3089,9 @@ sRect: TQDataTable
  • setType: TQIODevice TQSqlError
  • setUnchanged: TQCanvas
  • setUnderline: - TQFont TQTextEdit
  • setUndoDepth: - TQTextEdit
  • setUndoRedoEnabled: - TQTextEdit
  • setUnicode: + TQFont TQTextEdit
  • setUndoDepth: + TQTextEdit
  • setUndoRedoEnabled: + TQTextEdit
  • setUnicode: TQString
  • setUnicodeCodes: TQString
  • setUnicodeUris: TQUriDrag
  • setUpLayout: @@ -3117,7 +3117,7 @@ sRect: TQSizePolicy
  • setVerStretch: TQSizePolicy
  • setVersion: TQDataStream
  • setVerticalAlignment: - TQStyleSheetItem TQTextEdit
  • setVerticallyStretchable: + TQStyleSheetItem TQTextEdit
  • setVerticallyStretchable: TQDockWindow
  • setViewMode: TQFileDialog
  • setViewXForm: TQPainter
  • setViewport: @@ -3139,13 +3139,13 @@ sRect: TQGLContext
  • setWindowOpacity: TQWidget
  • setWindowState: TQWidget
  • setWordWrap: - TQTableItem TQTextEdit
  • setWordWrapIconText: + TQTableItem TQTextEdit
  • setWordWrapIconText: TQIconView
  • setWorkingDirectory: TQProcess
  • setWorldMatrix: TQCanvasView TQPainter
  • setWorldXForm: TQPainter
  • setWrapColumnOrWidth: - TQTextEdit
  • setWrapPolicy: - TQTextEdit
  • setWrapping: + TQTextEdit
  • setWrapPolicy: + TQTextEdit
  • setWrapping: TQDial TQSpinBox
  • setWritable: TQUrlInfo
  • setX: TQCanvasItem TQPoint TQRect
  • setXVelocity: @@ -3155,7 +3155,7 @@ sRect: TQCanvasItem
  • setYear: TQDateEdit
  • setZ: TQCanvasItem
  • setf: - TQTextStream
  • setup: + TQTextStream
  • setup: TQListViewItem TQPrinter
  • shadow: TQColorGroup
  • shape: TQCursor TQTabBar
  • shear: @@ -3184,7 +3184,7 @@ sRect: TQAxBase
  • signalNames: TQMetaObject
  • signalsBlocked: TQObject
  • simpleHeuristicNameMatch: - TQTextCodec
  • simplifyWhiteSpace: + TQTextCodec
  • simplifyWhiteSpace: TQCString TQString
  • singleShot: TQTimer
  • size: TQAsciiCache TQAsciiDict TQBitArray TQCache TQCanvas TQCanvasRectangle TQDict TQDirectPainter TQFile TQFileInfo TQFontMetrics TQGLColormap TQIODevice TQIconViewItem TQImage TQIntCache TQIntDict TQMap TQMemArray TQPicture TQPixmap TQPtrDict TQPtrVector TQRect TQResizeEvent TQSocket TQSqlQuery TQSqlResult TQUrlInfo TQValueList TQValueVector TQWidget
  • sizeChange: @@ -3195,7 +3195,7 @@ sRect: TQComboBox
  • sizePolicy: TQWidget
  • sizes: TQSplitter
  • skipWhiteSpace: - TQTextStream
  • skippedEntity: + TQTextStream
  • skippedEntity: TQXmlContentHandler
  • sleep: TQThread
  • sliderMoved: TQScrollBar TQSlider
  • sliderPressed: @@ -3220,8 +3220,8 @@ sRect: TQHeader
  • sortOrder: TQListView
  • sorting: TQDir TQIconView TQTable
  • source: - TQDragObject TQDropEvent TQTextBrowser
  • sourceChanged: - TQTextBrowser
  • sourceText: + TQDragObject TQDropEvent TQTextBrowser
  • sourceChanged: + TQTextBrowser
  • sourceText: TQTranslatorMessage
  • spacePressed: TQListView
  • spacerItem: TQLayoutItem
  • spacing: @@ -3287,7 +3287,7 @@ sRect: TQWidget
  • styleHint: TQFont TQFontInfo TQStyle
  • stylePixmap: TQStyle
  • styleSheet: - TQStyleSheetItem TQTextEdit
  • styleStrategy: + TQStyleSheetItem TQTextEdit
  • styleStrategy: TQFont
  • styleString: TQFontDatabase
  • styles: TQFontDatabase
  • subRect: @@ -3314,9 +3314,9 @@ sRect: TQTable
  • swapRGB: TQImage
  • swapRows: TQTable
  • sync: - TQTextEdit
  • syncX: + TQTextEdit
  • syncX: TQApplication
  • syntaxHighlighter: - TQTextEdit
  • system: + TQTextEdit
  • system: TQLocale
  • systemBitOrder: TQImage
  • systemByteOrder: TQImage
  • systemId: @@ -3326,13 +3326,13 @@ tab: TQPainter
  • tabAt: TQTabBar
  • tabBar: TQTabDialog TQTabWidget
  • tabChangesFocus: - TQTextEdit
  • tabIconSet: + TQTextEdit
  • tabIconSet: TQTabWidget
  • tabLabel: TQTabDialog TQTabWidget
  • tabList: TQTabBar
  • tabPosition: TQTabWidget
  • tabShape: TQTabWidget
  • tabStopWidth: - TQTextEdit
  • tabStops: + TQTextEdit
  • tabStops: TQPainter
  • tabToolTip: TQTabWidget
  • tabWidth: TQStyleOption
  • table: @@ -3351,13 +3351,13 @@ tab: TQBitArray
  • testOption: TQGLFormat
  • testWFlags: TQWidget
  • text: - TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQCheckListItem TQClipboard TQColorGroup TQComboBox TQComboTableItem TQDataTable TQDomElement TQIMEvent TQIconViewItem TQImage TQKeyEvent TQLabel TQLineEdit TQListBox TQListBoxItem TQListViewItem TQMenuData TQMessageBox TQPopupMenu TQPushButton TQRadioButton TQSpinBox TQSqlError TQTab TQTable TQTableItem TQTextEdit TQWhatsThis
  • textChanged: - TQComboBox TQLineEdit TQSpinBox TQTextEdit
  • textCursor: - TQTextEdit
  • textEdit: + TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQCheckListItem TQClipboard TQColorGroup TQComboBox TQComboTableItem TQDataTable TQDomElement TQIMEvent TQIconViewItem TQImage TQKeyEvent TQLabel TQLineEdit TQListBox TQListBoxItem TQListViewItem TQMenuData TQMessageBox TQPopupMenu TQPushButton TQRadioButton TQSpinBox TQSqlError TQTab TQTable TQTableItem TQTextEdit TQWhatsThis
  • textChanged: + TQComboBox TQLineEdit TQSpinBox TQTextEdit
  • textCursor: + TQTextEdit
  • textEdit: TQSyntaxHighlighter
  • textFlags: TQCanvasText
  • textFor: TQToolTip TQWhatsThis
  • textFormat: - TQLabel TQMessageBox TQTextEdit
  • textKeys: + TQLabel TQMessageBox TQTextEdit
  • textKeys: TQImage
  • textLabel: TQToolButton
  • textLanguages: TQImage
  • textLine: @@ -3442,7 +3442,7 @@ tab: TQCString TQLocale TQString
  • toULongLong: TQLocale TQString TQVariant
  • toUShort: TQCString TQLocale TQString
  • toUnicode: - TQTextCodec TQTextDecoder
  • toVector: + TQTextCodec TQTextDecoder
  • toVector: TQPtrList
  • toggle: TQAction TQButton TQCheckBox TQPushButton TQRadioButton TQToolButton
  • toggleBit: TQBitArray
  • toggleCurrentItem: @@ -3495,11 +3495,11 @@ ucs2: TQString
  • unPolish: TQStyle
  • uncache: TQScreen
  • underline: - TQFont TQTextEdit
  • underlinePos: + TQFont TQTextEdit
  • underlinePos: TQFontMetrics
  • undo: - TQLineEdit TQTextEdit
  • undoAvailable: - TQTextEdit
  • undoDepth: - TQTextEdit
  • undock: + TQLineEdit TQTextEdit
  • undoAvailable: + TQTextEdit
  • undoDepth: + TQTextEdit
  • undock: TQDockWindow
  • ungetch: TQFile TQIODevice TQSocket
  • unicode: TQChar TQString
  • unicodeUriToUri: @@ -3514,10 +3514,10 @@ ucs2: TQImageDecoder
  • unregisterSocketNotifier: TQEventLoop
  • unsetCursor: TQWidget
  • unsetDevice: - TQDataStream TQTextStream
  • unsetFont: + TQDataStream TQTextStream
  • unsetFont: TQWidget
  • unsetPalette: TQWidget
  • unsetf: - TQTextStream
  • unsqueeze: + TQTextStream
  • unsqueeze: TQTranslator
  • unuseJavaClass: TQNPlugin
  • upRect: TQSpinBox
  • update: @@ -3610,7 +3610,7 @@ wait: TQMacStyle
  • widgetToField: TQSqlForm
  • widgets: TQWidgetFactory
  • width: - TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPen TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQTextStream TQWidget
  • widthChanged: + TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPen TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQTextStream TQWidget
  • widthChanged: TQListViewItem
  • widthMM: TQPaintDeviceMetrics
  • widthUsed: TQSimpleRichText
  • wildcard: @@ -3630,12 +3630,12 @@ wait: TQWorkspace
  • windowOpacity: TQWidget
  • windowState: TQWidget
  • wordWrap: - TQTableItem TQTextEdit
  • wordWrapIconText: + TQTableItem TQTextEdit
  • wordWrapIconText: TQIconView
  • workingDirectory: TQProcess
  • worldMatrix: TQCanvasView TQPainter
  • wrapColumnOrWidth: - TQTextEdit
  • wrapPolicy: - TQTextEdit
  • wrapping: + TQTextEdit
  • wrapPolicy: + TQTextEdit
  • wrapping: TQDial TQSpinBox
  • writable: TQMetaProperty
  • write: TQAsciiDict TQDict TQImageIO TQIntDict TQNPInstance TQNPStream TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTranslatorMessage
  • writeBlock: @@ -3644,7 +3644,7 @@ wait: TQSettings
  • writeField: TQSqlForm
  • writeFields: TQDataBrowser TQDataView TQSqlForm
  • writeRawBytes: - TQDataStream TQTextStream
  • writeReady: + TQDataStream TQTextStream
  • writeReady: TQNPInstance
  • writeToStdin: TQProcess
  • wroteToStdin: TQProcess
  • @@ -3688,9 +3688,9 @@ y: TQDate
  • z: TQCanvasItem
  • zoomIn: - TQTextEdit
  • zoomOut: - TQTextEdit
  • zoomTo: - TQTextEdit + TQTextEdit
  • zoomOut: + TQTextEdit
  • zoomTo: + TQTextEdit diff --git a/doc/html/grapher-nsplugin-example.html b/doc/html/grapher-nsplugin-example.html index 3c8011ed..b4aec2ac 100644 --- a/doc/html/grapher-nsplugin-example.html +++ b/doc/html/grapher-nsplugin-example.html @@ -76,7 +76,7 @@ Implementation: // Include other TQt classes. #include <ntqpainter.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqbuffer.h> #include <ntqpixmap.h> #include <ntqmenubar.h> @@ -543,7 +543,7 @@ void Grapher::consumeLine() line.close(); line.open(IO_ReadOnly); - TQTextStream ts( &line ); + TQTextStream ts( &line ); if (ncols == 0 ) { ncols=0; @@ -559,7 +559,7 @@ void Grapher::consumeLine() t = new ColType(Label); } if (t) typelist.append(t); - } while (!ts.atEnd()); + } while (!ts.atEnd()); coltype = new ColType[ncols]; for (ColType* t = typelist.first(); t; t = typelist.next()) { coltype[ncols++] = *t; @@ -567,7 +567,7 @@ void Grapher::consumeLine() } else { int col=0; Datum *rowdata = new Datum[ncols]; - while ( col < ncols && !ts.atEnd() ) { + while ( col < ncols && !ts.atEnd() ) { switch (coltype[col]) { case Numeric: { double value; diff --git a/doc/html/headerfilesynonyms b/doc/html/headerfilesynonyms index 70be0748..6e514593 100644 --- a/doc/html/headerfilesynonyms +++ b/doc/html/headerfilesynonyms @@ -51,7 +51,7 @@ tqdomentity.h tqdom.h tqdomentityreference.h tqdom.h tqdomprocessinginstruction.h tqdom.h qstoreddrag.h ntqdragobject.h -qtextdrag.h ntqdragobject.h +tqtextdrag.h ntqdragobject.h tqimagedrag.h ntqdragobject.h quridrag.h ntqdragobject.h qcolordrag.h ntqdragobject.h @@ -143,10 +143,10 @@ qtableselection.h ntqtable.h qtableitem.h ntqtable.h qcombotableitem.h ntqtable.h qchecktableitem.h ntqtable.h -qtextencoder.h ntqtextcodec.h -qtextdecoder.h ntqtextcodec.h -qtextistream.h ntqtextstream.h -qtextostream.h ntqtextstream.h +tqtextencoder.h tqtextcodec.h +tqtextdecoder.h tqtextcodec.h +tqtextistream.h tqtextstream.h +tqtextostream.h tqtextstream.h qtooltipgroup.h ntqtooltip.h qtranslatormessage.h ntqtranslator.h qintvalidator.h ntqvalidator.h diff --git a/doc/html/headers.html b/doc/html/headers.html index 77436b33..524c78dd 100644 --- a/doc/html/headers.html +++ b/doc/html/headers.html @@ -253,12 +253,12 @@ body { background: #ffffff; color: black; }
  • ntqtabdialog.h
  • ntqtable.h
  • ntqtabwidget.h -
  • ntqtextbrowser.h -
  • ntqtextcodec.h -
  • ntqtextcodecplugin.h -
  • ntqtextedit.h -
  • ntqtextstream.h -
  • ntqtextview.h +
  • tqtextbrowser.h +
  • tqtextcodec.h +
  • tqtextcodecplugin.h +
  • tqtextedit.h +
  • tqtextstream.h +
  • tqtextview.h
  • ntqthread.h
  • ntqthreadstorage.h
  • ntqtimer.h diff --git a/doc/html/helpsystem.html b/doc/html/helpsystem.html index 56f6f4c8..c9dcc58d 100644 --- a/doc/html/helpsystem.html +++ b/doc/html/helpsystem.html @@ -50,7 +50,7 @@ help is a digression from their real task.

    @@ -232,7 +232,7 @@ classes), see TQt's Classes. @@ -243,7 +243,7 @@ classes), see TQt's Classes. diff --git a/doc/html/mdi-example.html b/doc/html/mdi-example.html index 118552fd..f74c89a9 100644 --- a/doc/html/mdi-example.html +++ b/doc/html/mdi-example.html @@ -79,7 +79,7 @@ signals: void message(const TQString&, int ); private: - TQTextEdit* medit; + TQTextEdit* medit; TQMovie * mmovie; TQString filename; }; @@ -151,8 +151,8 @@ private: #include <ntqapplication.h> #include <ntqpushbutton.h> #include <ntqaccel.h> -#include <ntqtextstream.h> -#include <ntqtextedit.h> +#include <tqtextstream.h> +#include <tqtextedit.h> #include <ntqpainter.h> #include <ntqpaintdevicemetrics.h> #include <ntqwhatsthis.h> @@ -412,7 +412,7 @@ void ApplicationWindow::tileHorizontal() : TQMainWindow( parent, name, wflags ) { mmovie = 0; - medit = new TQTextEdit( this ); + medit = new TQTextEdit( this ); setFocusProxy( medit ); setCentralWidget( medit ); } @@ -424,7 +424,7 @@ MDIWindow::~MDIWindow() void MDIWindow::closeEvent( TQCloseEvent *e ) { - if ( medit->isModified() ) { + if ( medit->isModified() ) { switch( TQMessageBox::warning( this, "Save Changes", tr("Save changes to %1?").arg( caption() ), tr("Yes"), tr("No"), tr("Cancel") ) ) { @@ -472,9 +472,9 @@ void MDIWindow::load( const TQString< } else { mmovie = 0; - TQTextStream t(&f); -TQString s = t.read(); - medit->setText( s ); + TQTextStream t(&f); +TQString s = t.read(); + medit->setText( s ); f.close(); @@ -490,7 +490,7 @@ void MDIWindow::save() return; } -TQString text = medit->text(); +TQString text = medit->text(); TQFile f( filename ); if ( !f.open( IO_WriteOnly ) ) { emit message( TQString("Could not write to %1").arg(filename), @@ -498,7 +498,7 @@ void MDIWindow::save() return; } - TQTextStream t( &f ); + TQTextStream t( &f ); t << text; f.close(); @@ -533,11 +533,11 @@ void MDIWindow::print( TQPrinter int dpiy = metrics.logicalDpiY(); int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins TQRect view( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin ); -TQSimpleRichText richText( TQStyleSheet::convertFromPlainText(medit->text()), +TQSimpleRichText richText( TQStyleSheet::convertFromPlainText(medit->text()), TQFont(), - medit->context(), - medit->styleSheet(), - medit->mimeSourceFactory(), + medit->context(), + medit->styleSheet(), + medit->mimeSourceFactory(), view.height() ); richText.setWidth( &p, view.width() ); int page = 1; diff --git a/doc/html/motif-walkthrough-10.html b/doc/html/motif-walkthrough-10.html index 2938da6d..c92bf6ee 100644 --- a/doc/html/motif-walkthrough-10.html +++ b/doc/html/motif-walkthrough-10.html @@ -75,7 +75,7 @@ very similar to those shown above.

    TQt provides many input and output classes. We can use these in MainWindow::readDB() and MainWindow::saveDB(). Currently, these functions use functions only found on UNIX machines. -Using TQFile and TQTextStream removes this dependency on UNIX, and we can +Using TQFile and TQTextStream removes this dependency on UNIX, and we can begin building and testing our application on Microsoft Windows and Apple Mac OS X.

    The platform-independent versions of the MainWindow::readDB() and diff --git a/doc/html/motif-walkthrough-8.html b/doc/html/motif-walkthrough-8.html index fbb387fa..687c519e 100644 --- a/doc/html/motif-walkthrough-8.html +++ b/doc/html/motif-walkthrough-8.html @@ -69,7 +69,7 @@ application on all platforms supported by TQt.

    We will use the first approach to complete the migration of the -example project used in this walkthrough, using TQTextEdit, TQLabel and +example project used in this walkthrough, using TQTextEdit, TQLabel and TQSpinBox to provide a similar look. The only difference is that we will not have tabs.

    We use TQt Designer to add the @@ -125,7 +125,7 @@ number (with an indication that the page is invalid).

    The PageChange() function is moved from todo.cpp to the MainWindow::pageChange() function in mainwindow.ui.h. As with the MainWindow::setPae() function, we need to modify the code to use the new widgets in our Main Window widget. -

    Note: TQTextEdit::text() returns a TQString, which needs to be converted +

    Note: TQTextEdit::text() returns a TQString, which needs to be converted into a normal char* array. To do this we create a copy of the string in the local encoding. We need to make the copy using tqstrdup() because the data contained in the TQCString returned by TQString::local8Bit() is deallocated when the TQCString is destroyed. @@ -141,7 +141,7 @@ renamed to MainWindow::readDB() and MainWindow::saveDB(), respectively. We need to modify the code in order to make the code work properly.

    First, We add #include statements for the MainWindow, TQSpinBox -and TQTextEdit classes. +and TQTextEdit classes.

    
    @@ -160,7 +160,7 @@ values.
     
     

    In the MainWindow::saveDB() function, we need to store the text -currently displayed, so we use TQTextEdit::text() instead of XmTextGetString(). Note: TQTextEdit::text() returns a TQString, which +currently displayed, so we use TQTextEdit::text() instead of XmTextGetString(). Note: TQTextEdit::text() returns a TQString, which needs to be converted into a normal char* array. To do this we create a copy of the string in the local encoding. We need to make the copy using tqstrdup() because the data contained in the TQCString diff --git a/doc/html/ntqapplication.html b/doc/html/ntqapplication.html index 3097b45c..8f532528 100644 --- a/doc/html/ntqapplication.html +++ b/doc/html/ntqapplication.html @@ -374,7 +374,7 @@ colors arguments to translate():

    See also TQObject::tr(), TQObject::trUtf8(), and TQString::fromUtf8(). @@ -752,9 +752,9 @@ control panel value is used. time by the user changing the global desktop settings.

    See also setCursorFlashTime(). -

    TQTextCodec * TQApplication::defaultCodec () const +

    TQTextCodec * TQApplication::defaultCodec () const

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    Returns TQTextCodec::codecForTr(). +

    Returns TQTextCodec::codecForTr().

    TQDesktopWidget * TQApplication::desktop () [static]

    @@ -1355,9 +1355,9 @@ milliseconds, but this may vary. cursor flash time for all windows.

    See also cursorFlashTime(). -

    void TQApplication::setDefaultCodec ( TQTextCodec * codec ) +

    void TQApplication::setDefaultCodec ( TQTextCodec * codec )

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    This is the same as TQTextCodec::setCodecForTr(). +

    This is the same as TQTextCodec::setCodecForTr().

    void TQApplication::setDesktopSettingsAware ( bool on ) [static]

    @@ -1612,7 +1612,7 @@ like this: If you support drag and drop in you application and a drag should start after a mouse click and after a certain time elapsed, you should use the value which this method returns as the delay (in ms). -

    TQt also uses this delay internally, e.g. in TQTextEdit and TQLineEdit, +

    TQt also uses this delay internally, e.g. in TQTextEdit and TQLineEdit, for starting a drag.

    The default value is 500 ms.

    See also setStartDragTime() and startDragDistance(). diff --git a/doc/html/ntqbig5codec.html b/doc/html/ntqbig5codec.html index 4739a369..d4a8797b 100644 --- a/doc/html/ntqbig5codec.html +++ b/doc/html/ntqbig5codec.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

    The TQBig5Codec class provides conversion to and from the Big5 encoding. More...

    #include <ntqbig5codec.h> -

    Inherits TQTextCodec. +

    Inherits TQTextCodec.

    List of all member functions.


    Detailed Description

    diff --git a/doc/html/ntqbuffer.html b/doc/html/ntqbuffer.html index b18b2fbe..0472498a 100644 --- a/doc/html/ntqbuffer.html +++ b/doc/html/ntqbuffer.html @@ -55,7 +55,7 @@ The TQBuffer class is an I/O device that operates on a

    TQBuffer is used to read and write to a memory buffer. It is -normally used with a TQTextStream or a TQDataStream. TQBuffer has an +normally used with a TQTextStream or a TQDataStream. TQBuffer has an associated TQByteArray which holds the buffer data. The size() of the buffer is automatically adjusted as data is written.

    The constructor TQBuffer(TQByteArray) creates a TQBuffer using an @@ -66,16 +66,16 @@ array because TQByteArray is explicitly

    Use open() to open the buffer before use and to set the mode (read-only, write-only, etc.). close() closes the buffer. The buffer must be closed before reopening or calling setBuffer(). -

    A common way to use TQBuffer is through TQDataStream or TQTextStream, which have constructors that take a TQBuffer +

    A common way to use TQBuffer is through TQDataStream or TQTextStream, which have constructors that take a TQBuffer parameter. For convenience, there are also TQDataStream and -TQTextStream constructors that take a TQByteArray parameter. These +TQTextStream constructors that take a TQByteArray parameter. These constructors create and open an internal TQBuffer.

    Note that TQTextStream can also operate on a TQString (a Unicode string); a TQBuffer cannot.

    You can also use TQBuffer directly through the standard TQIODevice functions readBlock(), writeBlock() readLine(), at(), getch(), putch() and ungetch(). -

    See also TQFile, TQDataStream, TQTextStream, TQByteArray, Shared Classes, Collection Classes, and Input/Output and Networking. +

    See also TQFile, TQDataStream, TQTextStream, TQByteArray, Shared Classes, Collection Classes, and Input/Output and Networking.


    Member Function Documentation

    TQBuffer::TQBuffer () diff --git a/doc/html/ntqdatastream.html b/doc/html/ntqdatastream.html index 5808241b..a5d439f3 100644 --- a/doc/html/ntqdatastream.html +++ b/doc/html/ntqdatastream.html @@ -99,7 +99,7 @@ byte order. For example, a data stream that is written by a PC under Windows can be read by a Sun SPARC running Solaris.

    You can also use a data stream to read/write raw unencoded binary data. If you want a "parsing" input -stream, see TQTextStream. +stream, see TQTextStream.

    The TQDataStream class implements the serialization of C++'s basic data types, like char, short, int, char*, etc. Serialization of more complex data is accomplished by breaking up @@ -217,7 +217,7 @@ read, then that number of bytes is read into the preallocated char*; writeBytes() writes a TQ_UINT32 containing the length of the data, followed by the data. Notice that any encoding/decoding of the data (apart from the length TQ_UINT32) must be done by you. -

    See also TQTextStream, TQVariant, and Input/Output and Networking. +

    See also TQTextStream, TQVariant, and Input/Output and Networking.


    Member Type Documentation

    TQDataStream::ByteOrder

    diff --git a/doc/html/ntqdockarea.html b/doc/html/ntqdockarea.html index 83db618f..d657ff47 100644 --- a/doc/html/ntqdockarea.html +++ b/doc/html/ntqdockarea.html @@ -114,7 +114,7 @@ see if a dock area contains a particular dock window use hasDockWindow(); to see how many dock windows a dock area contains use count().

    The streaming operators can write the positions of the dock -windows in the dock area to a TQTextStream. The positions can be +windows in the dock area to a TQTextStream. The positions can be read back later to restore the saved positions.

    Save the positions to a TQTextStream:

    @@ -250,14 +250,14 @@ constructor.
     
     

    Get this property's value with orientation().


    Related Functions

    -

    TQTextStream & operator<< ( TQTextStream & ts, const TQDockArea & dockArea ) +

    TQTextStream & operator<< ( TQTextStream & ts, const TQDockArea & dockArea )

    Writes the layout of the dock windows in dock area dockArea to the text stream ts.

    See also operator>>(). -

    TQTextStream & operator>> ( TQTextStream & ts, TQDockArea & dockArea ) +

    TQTextStream & operator>> ( TQTextStream & ts, TQDockArea & dockArea )

    Reads the layout description of the dock windows in dock area dockArea from the text stream ts and restores it. The layout diff --git a/doc/html/ntqdragobject.html b/doc/html/ntqdragobject.html index 4c226864..cbe68dd9 100644 --- a/doc/html/ntqdragobject.html +++ b/doc/html/ntqdragobject.html @@ -36,7 +36,7 @@ transfer. More...

    #include <ntqdragobject.h>

    Inherits TQObject and TQMimeSource. -

    Inherited by TQStoredDrag, TQTextDrag, TQImageDrag, and TQIconDrag. +

    Inherited by TQStoredDrag, TQTextDrag, TQImageDrag, and TQIconDrag.

    List of all member functions.

    Public Members

      diff --git a/doc/html/ntqdropsite.html b/doc/html/ntqdropsite.html index 84244c7e..cd49ff78 100644 --- a/doc/html/ntqdropsite.html +++ b/doc/html/ntqdropsite.html @@ -49,7 +49,7 @@ The TQDropSite class provides nothing and does nothing.

      It was used in TQt 1.x to do some drag and drop; that has since been folded into TQWidget.

      For detailed information about drag-and-drop, see the TQDragObject class. -

      See also TQDragObject, TQTextDrag, and TQImageDrag. +

      See also TQDragObject, TQTextDrag, and TQImageDrag.


      Member Function Documentation

      TQDropSite::TQDropSite ( TQWidget * self ) diff --git a/doc/html/ntqeucjpcodec.html b/doc/html/ntqeucjpcodec.html index 1b04559d..dc3a80c6 100644 --- a/doc/html/ntqeucjpcodec.html +++ b/doc/html/ntqeucjpcodec.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

      All the functions in this class are reentrant when TQt is built with thread support.

      #include <ntqeucjpcodec.h> -

      Inherits TQTextCodec. +

      Inherits TQTextCodec.

      List of all member functions.

      Public Members

        @@ -49,7 +49,7 @@ body { background: #ffffff; color: black; }

        The TQEucJpCodec class provides conversion to and from EUC-JP character sets. -

        More precisely, the TQEucJpCodec class subclasses TQTextCodec to +

        More precisely, the TQEucJpCodec class subclasses TQTextCodec to provide support for EUC-JP, the main legacy encoding for Unix machines in Japan.

        The environment variable UNICODEMAP_JP can be used to fine-tune @@ -97,12 +97,12 @@ Destroys the codec. Returns 18. -

        Reimplemented from TQTextCodec. +

        Reimplemented from TQTextCodec.

        const char * TQEucJpCodec::mimeName () const [virtual]

        Returns the codec's mime name. -

        Reimplemented from TQTextCodec. +

        Reimplemented from TQTextCodec.


        This file is part of the TQt toolkit. diff --git a/doc/html/ntqeuckrcodec.html b/doc/html/ntqeuckrcodec.html index 8ebb6cb9..315b2297 100644 --- a/doc/html/ntqeuckrcodec.html +++ b/doc/html/ntqeuckrcodec.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

        All the functions in this class are reentrant when TQt is built with thread support.

        #include <ntqeuckrcodec.h> -

        Inherits TQTextCodec. +

        Inherits TQTextCodec.

        List of all member functions.

        Public Members

          @@ -46,7 +46,7 @@ body { background: #ffffff; color: black; }

          The TQEucKrCodec class provides conversion to and from EUC-KR character sets. -

          The TQEucKrCodec class subclasses TQTextCodec to provide support for +

          The TQEucKrCodec class subclasses TQTextCodec to provide support for EUC-KR, the main legacy encoding for UNIX machines in Korea.

          It was largely written by Mizi Research Inc. Here is the copyright statement for the code as it was at the point of contribution. @@ -81,7 +81,7 @@ SUCH DAMAGE. Returns the codec's mime name. -

          Reimplemented from TQTextCodec. +

          Reimplemented from TQTextCodec.


          This file is part of the TQt toolkit. diff --git a/doc/html/ntqfile.html b/doc/html/ntqfile.html index 10393da1..94f45369 100644 --- a/doc/html/ntqfile.html +++ b/doc/html/ntqfile.html @@ -89,7 +89,7 @@ The TQFile class is an I/O device that operates on files.

          TQFile is an I/O device for reading and writing binary and text files. A TQFile may be used by itself or more conveniently with a -TQDataStream or TQTextStream. +TQDataStream or TQTextStream.

          The file name is usually passed in the constructor but can be changed with setName(). You can check for a file's existence with exists() and remove a file with remove(). @@ -102,17 +102,17 @@ and write with writeBlock(). TQFile al current file position or move to a new file position using the at() functions. If you've reached the end of the file, atEnd() returns TRUE. The file handle is returned by handle(). -

          Here is a code fragment that uses TQTextStream to read a text file +

          Here is a code fragment that uses TQTextStream to read a text file line by line. It prints each line with a line number.

               TQStringList lines;
               TQFile file( "file.txt" );
               if ( file.open( IO_ReadOnly ) ) {
          -        TQTextStream stream( &file );
          +        TQTextStream stream( &file );
                   TQString line;
                   int i = 1;
          -        while ( !stream.atEnd() ) {
          -            line = stream.readLine(); // line of text excluding '\n'
          +        while ( !stream.atEnd() ) {
          +            line = stream.readLine(); // line of text excluding '\n'
                       printf( "%3d: %s\n", i++, line.latin1() );
                       lines += line;
                   }
          @@ -126,7 +126,7 @@ example:
           
               TQFile file( "file.txt" );
               if ( file.open( IO_WriteOnly ) ) {
          -        TQTextStream stream( &file );
          +        TQTextStream stream( &file );
                   for ( TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it )
                       stream << *it << "\n";
                   file.close();
          @@ -140,7 +140,7 @@ as access permissions, file dates and file types.
           systems you may want to use encodeName() (and decodeName()) to
           convert the file name into the local encoding.
           

          -

          See also TQDataStream, TQTextStream, and Input/Output and Networking. +

          See also TQDataStream, TQTextStream, and Input/Output and Networking.


          Member Type Documentation

          TQFile::DecoderFn

          @@ -401,7 +401,7 @@ terminating newline is not stripped.

          This function is only efficient for buffered files. Avoid readLine() for files that have been opened with the IO_Raw flag. -

          See also readBlock() and TQTextStream::readLine(). +

          See also readBlock() and TQTextStream::readLine().

          Reimplemented from TQIODevice.

          TQ_LONG TQFile::readLine ( TQString & s, TQ_ULONG maxlen ) @@ -416,7 +416,7 @@ file. Any terminating newline is not stripped. readLine() for files that have been opened with the IO_Raw flag.

          Note that the string is read as plain Latin1 bytes, not Unicode. -

          See also readBlock() and TQTextStream::readLine(). +

          See also readBlock() and TQTextStream::readLine().

          bool TQFile::remove ()

          diff --git a/doc/html/ntqgb18030codec.html b/doc/html/ntqgb18030codec.html index 09a545e2..e1f13c31 100644 --- a/doc/html/ntqgb18030codec.html +++ b/doc/html/ntqgb18030codec.html @@ -36,7 +36,7 @@ GB18030/GBK/GB2312 encoding. More...

          All the functions in this class are reentrant when TQt is built with thread support.

          #include <ntqgb18030codec.h> -

          Inherits TQTextCodec. +

          Inherits TQTextCodec.

          Inherited by TQGbkCodec and TQGb2312Codec.

          List of all member functions.


          Detailed Description

          diff --git a/doc/html/ntqiconview.html b/doc/html/ntqiconview.html index 3b526388..6639bdf6 100644 --- a/doc/html/ntqiconview.html +++ b/doc/html/ntqiconview.html @@ -268,11 +268,11 @@ subclass TQIconView and reimplement TQIconView::dragObject

               TQDragObject *MyIconView::dragObject()
               {
          -        return new TQTextDrag( currentItem()->text(), this );
          +        return new TQTextDrag( currentItem()->text(), this );
               }
               
          -

          In this example we create a TQTextDrag object, (derived from +

          In this example we create a TQTextDrag object, (derived from TQDragObject), containing the item's label and return it as the drag object. We could just as easily have created a TQImageDrag from the item's pixmap and returned that instead. @@ -294,7 +294,7 @@ reimplement TQIconViewItem::acceptDropTQDropEvent *evt, const TQValueList<TQIconDragItem>& ) { TQString label; - if ( TQTextDrag::decode( evt, label ) ) + if ( TQTextDrag::decode( evt, label ) ) setText( label ); }

          diff --git a/doc/html/ntqiodevice.html b/doc/html/ntqiodevice.html index 8452d22c..3dc5cab6 100644 --- a/doc/html/ntqiodevice.html +++ b/doc/html/ntqiodevice.html @@ -97,7 +97,7 @@ superclass of all such devices; classes such as TQFileTQSocket inherit TQIODevice and implement virtual functions such as write() appropriately.

          Although applications sometimes use TQIODevice directly, it is -usually better to use TQTextStream and TQDataStream, which provide +usually better to use TQTextStream and TQDataStream, which provide stream operations on any TQIODevice subclass. TQTextStream provides text-oriented stream functionality (for human-readable ASCII files, for example), whereas TQDataStream deals with binary data in @@ -193,7 +193,7 @@ probably need:

          The three non-pure virtual functions need not be reimplemented for sequential devices. -

          See also TQDataStream, TQTextStream, and Input/Output and Networking. +

          See also TQDataStream, TQTextStream, and Input/Output and Networking.


          Member Type Documentation

          TQIODevice::Offset

          @@ -436,7 +436,7 @@ newline at the end if the line, it is not stripped. or -1 if an error occurred.

          This virtual function can be reimplemented much more efficiently by the most subclasses. -

          See also readBlock() and TQTextStream::readLine(). +

          See also readBlock() and TQTextStream::readLine().

          Reimplemented in TQFile.

          bool TQIODevice::reset () diff --git a/doc/html/ntqjiscodec.html b/doc/html/ntqjiscodec.html index 9cd38c4e..51940a11 100644 --- a/doc/html/ntqjiscodec.html +++ b/doc/html/ntqjiscodec.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

          All the functions in this class are reentrant when TQt is built with thread support.

          #include <ntqjiscodec.h> -

          Inherits TQTextCodec. +

          Inherits TQTextCodec.

          List of all member functions.

          Public Members

            @@ -46,7 +46,7 @@ body { background: #ffffff; color: black; }

            The TQJisCodec class provides conversion to and from JIS character sets. -

            More precisely, the TQJisCodec class subclasses TQTextCodec to +

            More precisely, the TQJisCodec class subclasses TQTextCodec to provide support for JIS X 0201 Latin, JIS X 0201 Kana, JIS X 0208 and JIS X 0212.

            The environment variable UNICODEMAP_JP can be used to fine-tune @@ -118,7 +118,7 @@ SUCH DAMAGE. Returns the codec's mime name. -

            Reimplemented from TQTextCodec. +

            Reimplemented from TQTextCodec.


            This file is part of the TQt toolkit. diff --git a/doc/html/ntqlabel.html b/doc/html/ntqlabel.html index 7d7ddd03..136d8e32 100644 --- a/doc/html/ntqlabel.html +++ b/doc/html/ntqlabel.html @@ -142,7 +142,7 @@ the other widget (called the TQLabel's "buddy"). For example: buddy (the TQLineEdit) when the user presses Alt+P. You can also use the setBuddy() function to accomplish the same thing.

            -

            See also TQLineEdit, TQTextEdit, TQPixmap, TQMovie, GUI Design Handbook: Label, Basic Widgets, and Text Related Classes. +

            See also TQLineEdit, TQTextEdit, TQPixmap, TQMovie, GUI Design Handbook: Label, Basic Widgets, and Text Related Classes.


            Member Function Documentation

            TQLabel::TQLabel ( TQWidget * parent, const char * name = 0, WFlags f = 0 ) @@ -393,7 +393,7 @@ set, the buddy accelerator key is updated from the new text.

            Note that Qlabel is well-suited to display small rich text documents, i.e. those small documents that get their document specific settings (font, text color, link color) from the label's -palette and font properties. For large documents, use TQTextEdit +palette and font properties. For large documents, use TQTextEdit in read-only mode instead. TQTextEdit will flicker less on resize and can also provide a scrollbar when necessary.

            See also textFormat, setBuddy(), and alignment. diff --git a/doc/html/ntqlineedit.html b/doc/html/ntqlineedit.html index c79bc71f..ea215dd2 100644 --- a/doc/html/ntqlineedit.html +++ b/doc/html/ntqlineedit.html @@ -148,7 +148,7 @@ a "write-only" field, for inputs such as passwords.

            The length of the text can be constrained to maxLength(). The text can be arbitrarily constrained using a validator() or an inputMask(), or both. -

            A related class is TQTextEdit which allows multi-line, rich-text +

            A related class is TQTextEdit which allows multi-line, rich-text editing.

            You can change the text with setText() or insert(). The text is retrieved with text(); the displayed text (which may be different, @@ -199,7 +199,7 @@ that presents some of these editing options.

            Any other key sequence that represents a valid character, will cause the character to be inserted into the line edit.

            -

            See also TQTextEdit, TQLabel, TQComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets. +

            See also TQTextEdit, TQLabel, TQComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets.


            Member Type Documentation

            TQLineEdit::EchoMode

            diff --git a/doc/html/ntqmainwindow.html b/doc/html/ntqmainwindow.html index 1aea36e2..40066283 100644 --- a/doc/html/ntqmainwindow.html +++ b/doc/html/ntqmainwindow.html @@ -150,7 +150,7 @@ toolbar buttons then describe the facilities of TQMainWindow itself.

                 TQMainWindow *mw = new TQMainWindow;
            -    TQTextEdit *edit = new TQTextEdit( mw, "editor" );
            +    TQTextEdit *edit = new TQTextEdit( mw, "editor" );
                 edit->setFocus();
                 mw->setCaption( "Main Window" );
                 mw->setCentralWidget( edit );
            @@ -205,7 +205,7 @@ clicked. Any dock window can be added to a dock area either using
             as the parent.
             

            -

                    e = new TQTextEdit( this, "editor" );
            +
                    e = new TQTextEdit( this, "editor" );
                     e->setFocus();
                     setCentralWidget( e );
                     statusBar()->message( "Ready", 2000 );
            @@ -355,7 +355,7 @@ for TQMainWindow.
             

                 TQFile file( filename );
                 if ( file.open( IO_WriteOnly ) ) {
            -        TQTextStream stream( &file );
            +        TQTextStream stream( &file );
                     stream << *mainWindow;
                     file.close();
                 }
            @@ -366,7 +366,7 @@ application is next started), do following:
             

                 TQFile file( filename );
                 if ( file.open( IO_ReadOnly ) ) {
            -        TQTextStream stream( &file );
            +        TQTextStream stream( &file );
                     stream >> *mainWindow;
                     file.close();
                 }
            @@ -921,7 +921,7 @@ and for connecting to the main window's widget's
             
             

            Set this property's value with setUsesTextLabel() and get this property's value with usesTextLabel().


            Related Functions

            -

            TQTextStream & operator<< ( TQTextStream & ts, const TQMainWindow & mainWindow ) +

            TQTextStream & operator<< ( TQTextStream & ts, const TQMainWindow & mainWindow )

            Writes the layout (sizes and positions) of the dock windows in the @@ -930,7 +930,7 @@ dock areas of the TQMainWindow mainWindow, including operator>>() and closeEvent(). -

            TQTextStream & operator>> ( TQTextStream & ts, TQMainWindow & mainWindow ) +

            TQTextStream & operator>> ( TQTextStream & ts, TQMainWindow & mainWindow )

            Reads the layout (sizes and positions) of the dock windows in the diff --git a/doc/html/ntqmultilineedit.html b/doc/html/ntqmultilineedit.html index 81fdce9c..f1632bc5 100644 --- a/doc/html/ntqmultilineedit.html +++ b/doc/html/ntqmultilineedit.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

            The TQMultiLineEdit widget is a simple editor for inputting text. More...

            #include <ntqmultilineedit.h> -

            Inherits TQTextEdit. +

            Inherits TQTextEdit.

            List of all member functions.

            Public Members

              @@ -101,10 +101,10 @@ body { background: #ffffff; color: black; }

              The TQMultiLineEdit was a simple editor widget in former TQt versions. TQt 3.0 includes a new richtext engine which obsoletes TQMultiLineEdit. It is still included for compatibility reasons. It is now a subclass of -TQTextEdit, and provides enough of the old TQMultiLineEdit API to keep old +TQTextEdit, and provides enough of the old TQMultiLineEdit API to keep old applications working.

              If you implement something new with TQMultiLineEdit, we suggest using -TQTextEdit instead and call TQTextEdit::setTextFormat(TQt::PlainText). +TQTextEdit instead and call TQTextEdit::setTextFormat(TQt::PlainText).

              Although most of the old TQMultiLineEdit API is still available, there is a few difference. The old TQMultiLineEdit operated on lines, not on paragraphs. As lines change all the time during wordwrap, the new @@ -114,9 +114,9 @@ operate on paragraphs. Further, getString() has been removed completely. It revealed too much of the internal data structure.

              Applications which made normal and reasonable use of TQMultiLineEdit should still work without problems. Some odd usage will require some -porting. In these cases, it may be better to use TQTextEdit now. +porting. In these cases, it may be better to use TQTextEdit now.

              -

              See also TQTextEdit and Advanced Widgets. +

              See also TQTextEdit and Advanced Widgets.


              Member Function Documentation

              TQMultiLineEdit::TQMultiLineEdit ( TQWidget * parent = 0, const char * name = 0 ) @@ -143,7 +143,7 @@ See the "atEnd" property for deta moves the cursor one position to the left. If a text has been selected by the user (e.g. by clicking and dragging) the cursor is put at the beginning of the selected text and the selected text is removed. -del() +del()

              void TQMultiLineEdit::cursorDown ( bool mark = FALSE ) [virtual protected]

              @@ -269,7 +269,7 @@ nothing is deleted.

              void TQMultiLineEdit::setAlignment ( int flags ) [virtual]

              Sets the editor's paragraph alignment to flags. See the "alignment" property for details. -

              Reimplemented from TQTextEdit. +

              Reimplemented from TQTextEdit.

              void TQMultiLineEdit::setAutoUpdate ( bool ) [virtual]

              @@ -321,8 +321,8 @@ string), or a null string if line

              See also atBeginning.

              bool edited

              This property holds whether the document has been edited by the user. -

              This is the same as TQTextEdit's "modifed" property. -

              See also TQTextEdit::modified. +

              This is the same as TQTextEdit's "modifed" property. +

              See also TQTextEdit::modified.

              Set this property's value with setEdited() and get this property's value with edited().

              int numLines

              This property holds the number of paragraphs in the editor. diff --git a/doc/html/ntqprocess.html b/doc/html/ntqprocess.html index a8d076a0..5cddf398 100644 --- a/doc/html/ntqprocess.html +++ b/doc/html/ntqprocess.html @@ -445,7 +445,7 @@ newline or carriage return characters and returns it. Returns TQString::null if canReadLineStderr() returns FALSE.

              By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with -TQTextCodec::setCodecForCStrings(). +TQTextCodec::setCodecForCStrings().

              See also canReadLineStderr(), readyReadStderr(), readStderr(), and readLineStdout().

              TQString TQProcess::readLineStdout () [virtual] @@ -455,7 +455,7 @@ newline or carriage return characters, and returns it. Returns TQString::null if canReadLineStdout() returns FALSE.

              By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with -TQTextCodec::setCodecForCStrings(). +TQTextCodec::setCodecForCStrings().

              See also canReadLineStdout(), readyReadStdout(), readStdout(), and readLineStderr().

              TQByteArray TQProcess::readStderr () [virtual] diff --git a/doc/html/ntqscrollview.html b/doc/html/ntqscrollview.html index ac419941..b5d1d5e4 100644 --- a/doc/html/ntqscrollview.html +++ b/doc/html/ntqscrollview.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

              #include <ntqscrollview.h>

              Inherits TQFrame. -

              Inherited by TQCanvasView, TQTable, TQGridView, TQIconView, TQListBox, TQListView, and TQTextEdit. +

              Inherited by TQCanvasView, TQTable, TQGridView, TQIconView, TQListBox, TQListView, and TQTextEdit.

              List of all member functions.

              Public Members

                diff --git a/doc/html/ntqsimplerichtext.html b/doc/html/ntqsimplerichtext.html index 1fc0f0bb..2bc8af8b 100644 --- a/doc/html/ntqsimplerichtext.html +++ b/doc/html/ntqsimplerichtext.html @@ -75,7 +75,7 @@ editable drawing canvases.

                Once constructed from a string the contents cannot be changed, only resized. If the contents change, just throw the rich text object away and make a new one with the new contents. -

                For large documents use TQTextEdit or TQTextBrowser. For very small +

                For large documents use TQTextEdit or TQTextBrowser. For very small items of rich text you can use a TQLabel.

                If you are using TQSimpleRichText to print in high resolution you should call setWidth(TQPainter, int) so that the content will be diff --git a/doc/html/ntqsjiscodec.html b/doc/html/ntqsjiscodec.html index b050245f..9168839a 100644 --- a/doc/html/ntqsjiscodec.html +++ b/doc/html/ntqsjiscodec.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

                All the functions in this class are reentrant when TQt is built with thread support.

                #include <ntqsjiscodec.h> -

                Inherits TQTextCodec. +

                Inherits TQTextCodec.

                List of all member functions.

                Public Members

                  @@ -48,7 +48,7 @@ body { background: #ffffff; color: black; } The TQSjisCodec class provides conversion to and from Shift-JIS. -

                  More precisely, the TQSjisCodec class subclasses TQTextCodec to +

                  More precisely, the TQSjisCodec class subclasses TQTextCodec to provide support for Shift-JIS, an encoding of JIS X 0201 Latin, JIS X 0201 Kana or JIS X 0208.

                  The environment variable UNICODEMAP_JP can be used to fine-tune @@ -99,7 +99,7 @@ Destroys the Shift-JIS codec. Returns the codec's mime name. -

                  Reimplemented from TQTextCodec. +

                  Reimplemented from TQTextCodec.


                  This file is part of the TQt toolkit. diff --git a/doc/html/ntqsplitter.html b/doc/html/ntqsplitter.html index 88f10e78..46eabb1a 100644 --- a/doc/html/ntqsplitter.html +++ b/doc/html/ntqsplitter.html @@ -89,12 +89,12 @@ The TQSplitter class implements a splitter widget.

                  A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled by a single splitter. -

                  To show a TQListBox, a TQListView and a TQTextEdit side by side: +

                  To show a TQListBox, a TQListView and a TQTextEdit side by side:

                           TQSplitter *split = new TQSplitter( parent );
                           TQListBox *lb = new TQListBox( split );
                           TQListView *lv = new TQListView( split );
                  -        TQTextEdit *ed = new TQTextEdit( split );
                  +        TQTextEdit *ed = new TQTextEdit( split );
                       

                  TQSplitter lays out its children horizontally (side by side); you @@ -309,14 +309,14 @@ side). The possible orientations are Horizo

                  Set this property's value with setOrientation() and get this property's value with orientation().


                  Related Functions

                  -

                  TQTextStream & operator<< ( TQTextStream & ts, const TQSplitter & splitter ) +

                  TQTextStream & operator<< ( TQTextStream & ts, const TQSplitter & splitter )

                  Writes the sizes and the hidden state of the widgets in the splitter splitter to the text stream ts.

                  See also operator>>(), sizes(), and TQWidget::hidden. -

                  TQTextStream & operator>> ( TQTextStream & ts, TQSplitter & splitter ) +

                  TQTextStream & operator>> ( TQTextStream & ts, TQSplitter & splitter )

                  Reads the sizes and the hidden state of the widgets in the diff --git a/doc/html/ntqstylesheet.html b/doc/html/ntqstylesheet.html index c2869171..d3ce655e 100644 --- a/doc/html/ntqstylesheet.html +++ b/doc/html/ntqstylesheet.html @@ -67,7 +67,7 @@ rendering and a generator of tags. definition of a set of tags. This definition will be used by the internal rich text rendering system to parse and display text documents to which the style sheet applies. Rich text is normally -visualized in a TQTextEdit or a TQTextBrowser. However, TQLabel, +visualized in a TQTextEdit or a TQTextBrowser. However, TQLabel, TQWhatsThis and TQMessageBox also support it, and other classes are likely to follow. With TQSimpleRichText it is possible to use the rich text renderer for custom widgets as well. @@ -84,11 +84,11 @@ HTML tables. attributes:

                  • title -- The caption of the document. This attribute is -easily accessible with TQTextEdit::documentTitle(). +easily accessible with TQTextEdit::documentTitle().
                  • type -- The type of the document. The default type is page. It indicates that the document is displayed in a page of its own. Another style is detail, which can be used to explain certain expressions in more detail in a -few sentences. For detail, TQTextBrowser will then keep +few sentences. For detail, TQTextBrowser will then keep the current page and display the new document in a small popup similar to TQWhatsThis. Note that links will not work in documents with <qt type="detail">...</qt>. @@ -298,8 +298,8 @@ Returns the application-wide default style sheet. This style sheet is used by rich text rendering classes such as TQSimpleRichText, TQWhatsThis and TQMessageBox to define the rendering style and available tags within rich text documents. It also serves as the -initial style sheet for the more complex render widgets, TQTextEdit -and TQTextBrowser. +initial style sheet for the more complex render widgets, TQTextEdit +and TQTextBrowser.

                    See also setDefaultSheet().

                    void TQStyleSheet::error ( const TQString & msg ) const [virtual] diff --git a/doc/html/ntqsyntaxhighlighter.html b/doc/html/ntqsyntaxhighlighter.html index e85b9792..05834e3b 100644 --- a/doc/html/ntqsyntaxhighlighter.html +++ b/doc/html/ntqsyntaxhighlighter.html @@ -53,7 +53,7 @@ implementing TQTextEdit syntax highlighters. The TQSyntaxHighlighter class is a base class for -implementing TQTextEdit syntax highlighters. +implementing TQTextEdit syntax highlighters.

                    A syntax highligher automatically highlights parts of the text in @@ -71,7 +71,7 @@ the font and color) to the text that is passed to it.

                    See also Basic Widgets and Text Related Classes.


                    Member Function Documentation

                    -

                    TQSyntaxHighlighter::TQSyntaxHighlighter ( TQTextEdit * textEdit ) +

                    TQSyntaxHighlighter::TQSyntaxHighlighter ( TQTextEdit * textEdit )

                    Constructs the TQSyntaxHighlighter and installs it on textEdit.

                    It is the caller's responsibility to delete the @@ -139,10 +139,10 @@ nothing is done.)

                    void TQSyntaxHighlighter::setFormat ( int start, int count, const TQFont & font )

                    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

                    TQTextEdit * TQSyntaxHighlighter::textEdit () const +

                    TQTextEdit * TQSyntaxHighlighter::textEdit () const

                    -

                    Returns the TQTextEdit on which this syntax highlighter is +

                    Returns the TQTextEdit on which this syntax highlighter is installed diff --git a/doc/html/ntqt.html b/doc/html/ntqt.html index b059c708..0ca19051 100644 --- a/doc/html/ntqt.html +++ b/doc/html/ntqt.html @@ -808,7 +808,7 @@ string using the current TQStyleSheet: if TQStyleSheet::mightBeRichText() returns TRUE, otherwise as PlainText.

                  • TQt::LogText - A special, limited text format which is only used -by TQTextEdit in an optimized mode. +by TQTextEdit in an optimized mode.

                  TQt::TimeSpec

                  diff --git a/doc/html/ntqtextbrowser.html b/doc/html/ntqtextbrowser.html deleted file mode 100644 index 525cc4dd..00000000 --- a/doc/html/ntqtextbrowser.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - -TQTextBrowser Class - - - - -
    TQStatusBarHorizontal bar suitable for presenting status information
    TQStyleSheetCollection of styles for rich text rendering and a generator of tags -
    TQTextBrowserRich text browser with hypertext navigation +
    TQTextBrowserRich text browser with hypertext navigation
    TQToolTipTool tips (balloon help) for any widget or rectangular part of a widget
    TQToolTipGroupCollects tool tips into related groups
    TQWhatsThisSimple description of any widget, i.e. answering the question "What's this?" diff --git a/doc/html/helpviewer-example.html b/doc/html/helpviewer-example.html index b4b0068f..52281f18 100644 --- a/doc/html/helpviewer-example.html +++ b/doc/html/helpviewer-example.html @@ -51,7 +51,7 @@ TQt's richtext capabilities. #define HELPWINDOW_H #include <ntqmainwindow.h> -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> #include <tqstringlist.h> #include <tqmap.h> #include <ntqdir.h> @@ -86,7 +86,7 @@ private: void readHistory(); void readBookmarks(); - TQTextBrowser* browser; + TQTextBrowser* browser; TQComboBox *pathCombo; int backwardId, forwardId; TQStringList history, bookmarks; @@ -124,7 +124,7 @@ private: #include <ntqtoolbutton.h> #include <ntqiconset.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqstylesheet.h> #include <ntqmessagebox.h> #include <ntqfiledialog.h> @@ -151,19 +151,19 @@ private: readHistory(); readBookmarks(); - browser = new TQTextBrowser( this ); + browser = new TQTextBrowser( this ); - browser->mimeSourceFactory()->setFilePath( _path ); + browser->mimeSourceFactory()->setFilePath( _path ); browser->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); - connect( browser, TQ_SIGNAL( sourceChanged(const TQString& ) ), + connect( browser, TQ_SIGNAL( sourceChanged(const TQString& ) ), this, TQ_SLOT( sourceChanged( const TQString&) ) ); setCentralWidget( browser ); if ( !home_.isEmpty() ) - browser->setSource( home_ ); + browser->setSource( home_ ); - connect( browser, TQ_SIGNAL( highlighted( const TQString&) ), + connect( browser, TQ_SIGNAL( highlighted( const TQString&) ), statusBar(), TQ_SLOT( message( const TQString&)) ); resize( 640,700 ); @@ -183,12 +183,12 @@ private: TQPopupMenu* go = new TQPopupMenu( this ); backwardId = go->insertItem( icon_back, - tr("&Backward"), browser, TQ_SLOT( backward() ), + tr("&Backward"), browser, TQ_SLOT( backward() ), CTRL+Key_Left ); forwardId = go->insertItem( icon_forward, - tr("&Forward"), browser, TQ_SLOT( forward() ), + tr("&Forward"), browser, TQ_SLOT( forward() ), CTRL+Key_Right ); - go->insertItem( icon_home, tr("&Home"), browser, TQ_SLOT( home() ) ); + go->insertItem( icon_home, tr("&Home"), browser, TQ_SLOT( home() ) ); TQPopupMenu* help = new TQPopupMenu( this ); help->insertItem( tr("&About"), this, TQ_SLOT( about() ) ); @@ -220,9 +220,9 @@ private: menuBar()->setItemEnabled( forwardId, FALSE); menuBar()->setItemEnabled( backwardId, FALSE); - connect( browser, TQ_SIGNAL( backwardAvailable( bool ) ), + connect( browser, TQ_SIGNAL( backwardAvailable( bool ) ), this, TQ_SLOT( setBackwardAvailable( bool ) ) ); - connect( browser, TQ_SIGNAL( forwardAvailable( bool ) ), + connect( browser, TQ_SIGNAL( forwardAvailable( bool ) ), this, TQ_SLOT( setForwardAvailable( bool ) ) ); @@ -230,13 +230,13 @@ private: addToolBar( toolbar, "Toolbar"); TQToolButton* button; - button = new TQToolButton( icon_back, tr("Backward"), "", browser, TQ_SLOT(backward()), toolbar ); - connect( browser, TQ_SIGNAL( backwardAvailable(bool) ), button, TQ_SLOT( setEnabled(bool) ) ); + button = new TQToolButton( icon_back, tr("Backward"), "", browser, TQ_SLOT(backward()), toolbar ); + connect( browser, TQ_SIGNAL( backwardAvailable(bool) ), button, TQ_SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); - button = new TQToolButton( icon_forward, tr("Forward"), "", browser, TQ_SLOT(forward()), toolbar ); - connect( browser, TQ_SIGNAL( forwardAvailable(bool) ), button, TQ_SLOT( setEnabled(bool) ) ); + button = new TQToolButton( icon_forward, tr("Forward"), "", browser, TQ_SLOT(forward()), toolbar ); + connect( browser, TQ_SIGNAL( forwardAvailable(bool) ), button, TQ_SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); - button = new TQToolButton( icon_home, tr("Home"), "", browser, TQ_SLOT(home()), toolbar ); + button = new TQToolButton( icon_home, tr("Home"), "", browser, TQ_SLOT(home()), toolbar ); toolbar->addSeparator(); @@ -267,10 +267,10 @@ void HelpWindow::setForwardAvailable( bool b) void HelpWindow::sourceChanged( const TQString& url ) { - if ( browser->documentTitle().isNull() ) + if ( browser->documentTitle().isNull() ) setCaption( "TQt Example - Helpviewer - " + url ); else - setCaption( "TQt Example - Helpviewer - " + browser->documentTitle() ) ; + setCaption( "TQt Example - Helpviewer - " + browser->documentTitle() ) ; if ( !url.isEmpty() && pathCombo ) { bool exists = FALSE; @@ -329,13 +329,13 @@ void HelpWindow::openFile() #ifndef TQT_NO_FILEDIALOG TQString fn = TQFileDialog::getOpenFileName( TQString::null, TQString::null, this ); if ( !fn.isEmpty() ) - browser->setSource( fn ); + browser->setSource( fn ); #endif } void HelpWindow::newWindow() { - ( new HelpWindow(browser->source(), "qbrowser") )->show(); + ( new HelpWindow(browser->source(), "qbrowser") )->show(); } void HelpWindow::print() @@ -351,11 +351,11 @@ void HelpWindow::print() int dpiy = metrics.logicalDpiY(); int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins TQRect view( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin ); - TQSimpleRichText richText( browser->text(), + TQSimpleRichText richText( browser->text(), TQFont(), - browser->context(), - browser->styleSheet(), - browser->mimeSourceFactory(), + browser->context(), + browser->styleSheet(), + browser->mimeSourceFactory(), view.height() ); richText.setWidth( &p, view.width() ); int page = 1; @@ -376,7 +376,7 @@ void HelpWindow::print() void HelpWindow::pathSelected( const TQString &_path ) { - browser->setSource( _path ); + browser->setSource( _path ); if ( mHistory.values().contains(_path) ) mHistory[ hist->insertItem( _path ) ] = _path; } @@ -408,18 +408,18 @@ void HelpWindow::readBookmarks() void HelpWindow::histChosen( int i ) { if ( mHistory.contains( i ) ) - browser->setSource( mHistory[ i ] ); + browser->setSource( mHistory[ i ] ); } void HelpWindow::bookmChosen( int i ) { if ( mBookmarks.contains( i ) ) - browser->setSource( mBookmarks[ i ] ); + browser->setSource( mBookmarks[ i ] ); } void HelpWindow::addBookmark() { - mBookmarks[ bookm->insertItem( caption() ) ] = browser->context(); + mBookmarks[ bookm->insertItem( caption() ) ] = browser->context(); } diff --git a/doc/html/hierarchy.html b/doc/html/hierarchy.html index 42389913..eda73d45 100644 --- a/doc/html/hierarchy.html +++ b/doc/html/hierarchy.html @@ -334,7 +334,7 @@ classes in the TQt API.
  • TQColorDrag
  • TQUriDrag -
  • TQTextDrag +
  • TQTextDrag
  • TQEditorFactory
  • TQSplitter @@ -522,7 +522,7 @@ classes in the TQt API.
  • TQWhatsThis
  • TQTableSelection -
  • TQTextCodec +
  • TQTextCodec -
  • TQTextCodecPlugin -
  • TQTextDecoder -
  • TQTextEncoder -
  • TQTextStream +
  • TQTextCodecPlugin +
  • TQTextDecoder +
  • TQTextEncoder +
  • TQTextStream
  • TQThreadStorage
  • TQTime diff --git a/doc/html/httpd-example.html b/doc/html/httpd-example.html index 32b50247..12443998 100644 --- a/doc/html/httpd-example.html +++ b/doc/html/httpd-example.html @@ -54,10 +54,10 @@ sending the page, it closes the connection. #include <ntqserversocket.h> #include <ntqapplication.h> #include <ntqmainwindow.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqvbox.h> #include <ntqlabel.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqpushbutton.h> // HttpDaemon is the the class that implements the simple HTTP server. @@ -102,8 +102,8 @@ private slots: if ( socket->canReadLine() ) { TQStringList tokens = TQStringList::split( TQRegExp("[ \r\n][ \r\n]*"), socket->readLine() ); if ( tokens[0] == "GET" ) { - TQTextStream os( socket ); - os.setEncoding( TQTextStream::UnicodeUTF8 ); + TQTextStream os( socket ); + os.setEncoding( TQTextStream::UnicodeUTF8 ); os << "HTTP/1.0 200 Ok\r\n" "Content-Type: text/html; charset=\"utf-8\"\r\n" "\r\n" @@ -139,7 +139,7 @@ public: ).arg( httpd->port() ); TQLabel *lb = new TQLabel( itext, this ); lb->setAlignment( AlignHCenter ); - infoText = new TQTextView( this ); + infoText = new TQTextView( this ); TQPushButton *quit = new TQPushButton( "quit" , this ); connect( httpd, TQ_SIGNAL(newConnect()), TQ_SLOT(newConnect()) ); @@ -155,19 +155,19 @@ public: private slots: void newConnect() { - infoText->append( "New connection" ); + infoText->append( "New connection" ); } void endConnect() { - infoText->append( "Connection closed\n\n" ); + infoText->append( "Connection closed\n\n" ); } void wroteToClient() { - infoText->append( "Wrote to client" ); + infoText->append( "Wrote to client" ); } private: - TQTextView *infoText; + TQTextView *infoText; }; diff --git a/doc/html/i18n-example.html b/doc/html/i18n-example.html index 884cd6aa..5f976c91 100644 --- a/doc/html/i18n-example.html +++ b/doc/html/i18n-example.html @@ -175,7 +175,7 @@ void MyWidget::initChoices(TQWidget* parent) #include <ntqbuttongroup.h> #include <ntqpushbutton.h> #include <ntqsignalmapper.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <stdlib.h> #if defined(Q_OS_UNIX) @@ -275,7 +275,7 @@ int main( int argc, char** argv ) r = 2; } else { TQButtonGroup *bg = new TQButtonGroup(4,TQt::Vertical,"Choose Locales",&dlg); - TQString loc = TQTextCodec::locale(); + TQString loc = TQTextCodec::locale(); for ( int i=0; qm[i]; i++ ) { qmb[i] = new TQCheckBox((const char*)qm[i],bg); qmb[i]->setChecked( loc == qm[i] ); diff --git a/doc/html/i18n.html b/doc/html/i18n.html index 6c09191b..e606ce29 100644 --- a/doc/html/i18n.html +++ b/doc/html/i18n.html @@ -133,7 +133,7 @@ the fl and fi ligatures used in typesetting US and European books.

    TQt tries to take care of all the special features listed above. You usually don't have to worry about these features so long as you use -TQt's input widgets (e.g. TQLineEdit, TQTextEdit, and derived classes) +TQt's input widgets (e.g. TQLineEdit, TQTextEdit, and derived classes) and TQt's display widgets (e.g. TQLabel).

    Support for these writing systems is transparent to the programmer and completely encapsulated in TQt's text engine. This means that you @@ -151,7 +151,7 @@ string. In some languages (e.g. Arabic or languages from the Indian subcontinent), the width and shape of a glyph changes depending on the surrounding characters. Writing input controls usually requires a certain knowledge of the scripts it is going to be used in. Usually -the easiest way is to subclass TQLineEdit or TQTextEdit. +the easiest way is to subclass TQLineEdit or TQTextEdit.

    The following sections give some information on the status of the internationalization (i18n) support in TQt. @@ -389,7 +389,7 @@ useful.)

    Support for Encodings

    -

    The TQTextCodec class and the facilities in TQTextStream make it easy to +

    The TQTextCodec class and the facilities in TQTextStream make it easy to support many input and output encodings for your users' data. When an application starts, the locale of the machine will determine the 8-bit encoding used when dealing with 8-bit data: such as for font @@ -402,8 +402,8 @@ would be:

         TQString string = ...; // some Unicode text
     
    -    TQTextCodec* codec = TQTextCodec::codecForName( "ISO 8859-5" );
    -    TQCString encoded_string = codec->fromUnicode( string );
    +    TQTextCodec* codec = TQTextCodec::codecForName( "ISO 8859-5" );
    +    TQCString encoded_string = codec->fromUnicode( string );
     
         ...; // use encoded_string in 8-bit operations
     
    @@ -421,8 +421,8 @@ conversion:

         TQCString encoded_string = ...; // Some ISO 8859-5 encoded text.
     
    -    TQTextCodec* codec = TQTextCodec::codecForName("ISO 8859-5");
    -    TQString string = codec->toUnicode(encoded_string);
    +    TQTextCodec* codec = TQTextCodec::codecForName("ISO 8859-5");
    +    TQString string = codec->toUnicode(encoded_string);
     
         ...; // Use string in all of TQt's TQString operations.
     
    @@ -434,18 +434,18 @@ need to process existing documents. In general, Unicode (UTF-16 or UTF-8) is best for information transferred between arbitrary people, while within a language or national group, a local standard is often more appropriate. The most important encoding to support is the one -returned by TQTextCodec::codecForLocale(), as this is the one the user +returned by TQTextCodec::codecForLocale(), as this is the one the user is most likely to need for communicating with other people and applications (this is the codec used by local8Bit()).

    TQt supports most of the more frequently used encodings natively. For a -complete list of supported encodings see the TQTextCodec +complete list of supported encodings see the TQTextCodec documentation.

    In some cases and for less frequently used encodings it may be -necessary to write your own TQTextCodec subclass. Depending on the +necessary to write your own TQTextCodec subclass. Depending on the urgency, it may be useful to contact Trolltech technical support or ask on the qt-interest mailing list to see if someone else is already working on supporting the encoding. A useful interim measure -can be to use the TQTextCodec::loadCharmapFile() function to build a +can be to use the TQTextCodec::loadCharmapFile() function to build a data-driven codec, although this approach has a memory and speed penalty, especially with dynamically loaded libraries. For details of writing your own TQTextCodec, see the main TQTextCodec class @@ -517,7 +517,7 @@ this is the Unix convention (see TQFile::setEncodingFunction() to explore alternative encodings).

  • File I/O defaults to the local 8-bit encoding, -with Unicode options in TQTextStream. +with Unicode options in TQTextStream.

    Windows

    @@ -553,9 +553,9 @@ results, use complete locales from your system vendor.
  • TQHebrewCodecConversion to and from visually ordered Hebrew
    TQJisCodecConversion to and from JIS character sets
    TQSjisCodecConversion to and from Shift-JIS -
    TQTextCodecConversion between text encodings -
    TQTextDecoderState-based decoder -
    TQTextEncoderState-based encoder +
    TQTextCodecConversion between text encodings +
    TQTextDecoderState-based decoder +
    TQTextEncoderState-based encoder
    TQTranslatorInternationalization support for text output
    TQTranslatorMessageTranslator message and its properties
    TQTsciiCodecConversion to and from the Tamil TSCII encoding diff --git a/doc/html/iconview-simple_dd-main-cpp.html b/doc/html/iconview-simple_dd-main-cpp.html index 8a36a84b..05393a55 100644 --- a/doc/html/iconview-simple_dd-main-cpp.html +++ b/doc/html/iconview-simple_dd-main-cpp.html @@ -120,7 +120,7 @@ const char* green_icon[]={ void DDListBox::dragEnterEvent( TQDragEnterEvent *evt ) { - if ( TQTextDrag::canDecode( evt ) ) + if ( TQTextDrag::canDecode( evt ) ) evt->accept(); } @@ -129,7 +129,7 @@ const char* green_icon[]={ { TQString text; - if ( TQTextDrag::decode( evt, text ) ) + if ( TQTextDrag::decode( evt, text ) ) insertItem( text ); } @@ -144,7 +144,7 @@ const char* green_icon[]={ void DDListBox::mouseMoveEvent( TQMouseEvent * ) { if ( dragging ) { - TQDragObject *d = new TQTextDrag( currentText(), this ); + TQDragObject *d = new TQTextDrag( currentText(), this ); d->dragCopy(); // do NOT delete d. dragging = FALSE; } @@ -166,7 +166,7 @@ const char* green_icon[]={ { TQString label; - if ( TQTextDrag::decode( evt, label ) ) + if ( TQTextDrag::decode( evt, label ) ) setText( label ); } @@ -175,14 +175,14 @@ const char* green_icon[]={ TQDragObject *DDIconView::dragObject() { - return new TQTextDrag( currentItem()->text(), this ); + return new TQTextDrag( currentItem()->text(), this ); } void DDIconView::slotNewItem( TQDropEvent *evt, const TQValueList<TQIconDragItem>& ) { TQString label; - if ( TQTextDrag::decode( evt, label ) ) { + if ( TQTextDrag::decode( evt, label ) ) { DDIconViewItem *item = new DDIconViewItem( this, label ); item->setRenameEnabled( TRUE ); } diff --git a/doc/html/index b/doc/html/index index 8999a0cb..ddca9f1e 100644 --- a/doc/html/index +++ b/doc/html/index @@ -6662,259 +6662,259 @@ "QTabletEvent::xTilt" qtabletevent.html#xTilt "QTabletEvent::y" qtabletevent.html#y "QTabletEvent::yTilt" qtabletevent.html#yTilt -"QTextBrowser" ntqtextbrowser.html -"QTextBrowser::anchorClicked" ntqtextbrowser.html#anchorClicked -"QTextBrowser::backward" ntqtextbrowser.html#backward -"QTextBrowser::backwardAvailable" ntqtextbrowser.html#backwardAvailable -"QTextBrowser::forward" ntqtextbrowser.html#forward -"QTextBrowser::forwardAvailable" ntqtextbrowser.html#forwardAvailable -"QTextBrowser::highlighted" ntqtextbrowser.html#highlighted -"QTextBrowser::home" ntqtextbrowser.html#home -"QTextBrowser::keyPressEvent" ntqtextbrowser.html#keyPressEvent -"QTextBrowser::linkClicked" ntqtextbrowser.html#linkClicked -"QTextBrowser::modified" ntqtextbrowser.html#modified-prop -"QTextBrowser::overwriteMode" ntqtextbrowser.html#overwriteMode-prop -"QTextBrowser::readOnly" ntqtextbrowser.html#readOnly-prop -"QTextBrowser::reload" ntqtextbrowser.html#reload -"QTextBrowser::setSource" ntqtextbrowser.html#setSource -"QTextBrowser::setText" ntqtextbrowser.html#setText -"QTextBrowser::source" ntqtextbrowser.html#source -"QTextBrowser::source" ntqtextbrowser.html#source-prop -"QTextBrowser::sourceChanged" ntqtextbrowser.html#sourceChanged -"QTextBrowser::undoDepth" ntqtextbrowser.html#undoDepth-prop -"QTextBrowser::undoRedoEnabled" ntqtextbrowser.html#undoRedoEnabled-prop -"QTextCodec" ntqtextcodec.html -"QTextCodec::canEncode" ntqtextcodec.html#canEncode -"QTextCodec::codecForCStrings" ntqtextcodec.html#codecForCStrings -"QTextCodec::codecForContent" ntqtextcodec.html#codecForContent -"QTextCodec::codecForIndex" ntqtextcodec.html#codecForIndex -"QTextCodec::codecForLocale" ntqtextcodec.html#codecForLocale -"QTextCodec::codecForMib" ntqtextcodec.html#codecForMib -"QTextCodec::codecForName" ntqtextcodec.html#codecForName -"QTextCodec::codecForTr" ntqtextcodec.html#codecForTr -"QTextCodec::deleteAllCodecs" ntqtextcodec.html#deleteAllCodecs -"QTextCodec::fromUnicode" ntqtextcodec.html#fromUnicode -"QTextCodec::heuristicContentMatch" ntqtextcodec.html#heuristicContentMatch -"QTextCodec::heuristicNameMatch" ntqtextcodec.html#heuristicNameMatch -"QTextCodec::loadCharmap" ntqtextcodec.html#loadCharmap -"QTextCodec::loadCharmapFile" ntqtextcodec.html#loadCharmapFile -"QTextCodec::locale" ntqtextcodec.html#locale -"QTextCodec::makeDecoder" ntqtextcodec.html#makeDecoder -"QTextCodec::makeEncoder" ntqtextcodec.html#makeEncoder -"QTextCodec::mibEnum" ntqtextcodec.html#mibEnum -"QTextCodec::mimeName" ntqtextcodec.html#mimeName -"QTextCodec::name" ntqtextcodec.html#name -"QTextCodec::setCodecForCStrings" ntqtextcodec.html#setCodecForCStrings -"QTextCodec::setCodecForLocale" ntqtextcodec.html#setCodecForLocale -"QTextCodec::setCodecForTr" ntqtextcodec.html#setCodecForTr -"QTextCodec::simpleHeuristicNameMatch" ntqtextcodec.html#simpleHeuristicNameMatch -"QTextCodec::toUnicode" ntqtextcodec.html#toUnicode -"QTextCodec::~QTextCodec" ntqtextcodec.html#~QTextCodec -"QTextCodecPlugin" ntqtextcodecplugin.html -"QTextCodecPlugin::createForMib" ntqtextcodecplugin.html#createForMib -"QTextCodecPlugin::createForName" ntqtextcodecplugin.html#createForName -"QTextCodecPlugin::mibEnums" ntqtextcodecplugin.html#mibEnums -"QTextCodecPlugin::names" ntqtextcodecplugin.html#names -"QTextCodecPlugin::~QTextCodecPlugin" ntqtextcodecplugin.html#~QTextCodecPlugin -"QTextDecoder" qtextdecoder.html -"QTextDecoder::toUnicode" qtextdecoder.html#toUnicode -"QTextDecoder::~QTextDecoder" qtextdecoder.html#~QTextDecoder -"QTextDrag" qtextdrag.html -"QTextDrag::canDecode" qtextdrag.html#canDecode -"QTextDrag::decode" qtextdrag.html#decode -"QTextDrag::setSubtype" qtextdrag.html#setSubtype -"QTextDrag::setText" qtextdrag.html#setText -"QTextDrag::~QTextDrag" qtextdrag.html#~QTextDrag -"QTextEdit" ntqtextedit.html -"QTextEdit::AutoFormatting" ntqtextedit.html#AutoFormatting -"QTextEdit::CursorAction" ntqtextedit.html#CursorAction -"QTextEdit::KeyboardAction" ntqtextedit.html#KeyboardAction -"QTextEdit::VerticalAlignment" ntqtextedit.html#VerticalAlignment -"QTextEdit::WordWrap" ntqtextedit.html#WordWrap -"QTextEdit::WrapPolicy" ntqtextedit.html#WrapPolicy -"QTextEdit::alignment" ntqtextedit.html#alignment -"QTextEdit::anchorAt" ntqtextedit.html#anchorAt -"QTextEdit::append" ntqtextedit.html#append -"QTextEdit::autoFormatting" ntqtextedit.html#autoFormatting -"QTextEdit::autoFormatting" ntqtextedit.html#autoFormatting-prop -"QTextEdit::bold" ntqtextedit.html#bold -"QTextEdit::charAt" ntqtextedit.html#charAt -"QTextEdit::clear" ntqtextedit.html#clear -"QTextEdit::clearParagraphBackground" ntqtextedit.html#clearParagraphBackground -"QTextEdit::clicked" ntqtextedit.html#clicked -"QTextEdit::color" ntqtextedit.html#color -"QTextEdit::context" ntqtextedit.html#context -"QTextEdit::copy" ntqtextedit.html#copy -"QTextEdit::copyAvailable" ntqtextedit.html#copyAvailable -"QTextEdit::createPopupMenu" ntqtextedit.html#createPopupMenu -"QTextEdit::currentAlignmentChanged" ntqtextedit.html#currentAlignmentChanged -"QTextEdit::currentColorChanged" ntqtextedit.html#currentColorChanged -"QTextEdit::currentFont" ntqtextedit.html#currentFont -"QTextEdit::currentFontChanged" ntqtextedit.html#currentFontChanged -"QTextEdit::currentVerticalAlignmentChanged" ntqtextedit.html#currentVerticalAlignmentChanged -"QTextEdit::cursorPositionChanged" ntqtextedit.html#cursorPositionChanged -"QTextEdit::cut" ntqtextedit.html#cut -"QTextEdit::del" ntqtextedit.html#del -"QTextEdit::doKeyboardAction" ntqtextedit.html#doKeyboardAction -"QTextEdit::documentTitle" ntqtextedit.html#documentTitle -"QTextEdit::documentTitle" ntqtextedit.html#documentTitle-prop -"QTextEdit::doubleClicked" ntqtextedit.html#doubleClicked -"QTextEdit::ensureCursorVisible" ntqtextedit.html#ensureCursorVisible -"QTextEdit::family" ntqtextedit.html#family -"QTextEdit::find" ntqtextedit.html#find -"QTextEdit::focusNextPrevChild" ntqtextedit.html#focusNextPrevChild -"QTextEdit::getCursorPosition" ntqtextedit.html#getCursorPosition -"QTextEdit::getSelection" ntqtextedit.html#getSelection -"QTextEdit::hasSelectedText" ntqtextedit.html#hasSelectedText -"QTextEdit::hasSelectedText" ntqtextedit.html#hasSelectedText-prop -"QTextEdit::heightForWidth" ntqtextedit.html#heightForWidth -"QTextEdit::insert" ntqtextedit.html#insert -"QTextEdit::insertAt" ntqtextedit.html#insertAt -"QTextEdit::insertParagraph" ntqtextedit.html#insertParagraph -"QTextEdit::isModified" ntqtextedit.html#isModified -"QTextEdit::isOverwriteMode" ntqtextedit.html#isOverwriteMode -"QTextEdit::isReadOnly" ntqtextedit.html#isReadOnly -"QTextEdit::isRedoAvailable" ntqtextedit.html#isRedoAvailable -"QTextEdit::isUndoAvailable" ntqtextedit.html#isUndoAvailable -"QTextEdit::isUndoRedoEnabled" ntqtextedit.html#isUndoRedoEnabled -"QTextEdit::italic" ntqtextedit.html#italic -"QTextEdit::keyPressEvent" ntqtextedit.html#keyPressEvent -"QTextEdit::length" ntqtextedit.html#length -"QTextEdit::length" ntqtextedit.html#length-prop -"QTextEdit::lineOfChar" ntqtextedit.html#lineOfChar -"QTextEdit::lines" ntqtextedit.html#lines -"QTextEdit::linesOfParagraph" ntqtextedit.html#linesOfParagraph -"QTextEdit::linkUnderline" ntqtextedit.html#linkUnderline -"QTextEdit::linkUnderline" ntqtextedit.html#linkUnderline-prop -"QTextEdit::maxLogLines" ntqtextedit.html#maxLogLines -"QTextEdit::mimeSourceFactory" ntqtextedit.html#mimeSourceFactory -"QTextEdit::modificationChanged" ntqtextedit.html#modificationChanged -"QTextEdit::modified" ntqtextedit.html#modified-prop -"QTextEdit::moveCursor" ntqtextedit.html#moveCursor -"QTextEdit::optimCheckLimit" ntqtextedit.html#optimCheckLimit -"QTextEdit::overwriteMode" ntqtextedit.html#overwriteMode-prop -"QTextEdit::paper" ntqtextedit.html#paper -"QTextEdit::paper" ntqtextedit.html#paper-prop -"QTextEdit::paragraphAt" ntqtextedit.html#paragraphAt -"QTextEdit::paragraphBackgroundColor" ntqtextedit.html#paragraphBackgroundColor -"QTextEdit::paragraphLength" ntqtextedit.html#paragraphLength -"QTextEdit::paragraphRect" ntqtextedit.html#paragraphRect -"QTextEdit::paragraphs" ntqtextedit.html#paragraphs -"QTextEdit::paste" ntqtextedit.html#paste -"QTextEdit::pasteSpecial" ntqtextedit.html#pasteSpecial -"QTextEdit::pasteSubType" ntqtextedit.html#pasteSubType -"QTextEdit::placeCursor" ntqtextedit.html#placeCursor -"QTextEdit::pointSize" ntqtextedit.html#pointSize -"QTextEdit::readOnly" ntqtextedit.html#readOnly-prop -"QTextEdit::redo" ntqtextedit.html#redo -"QTextEdit::redoAvailable" ntqtextedit.html#redoAvailable -"QTextEdit::removeParagraph" ntqtextedit.html#removeParagraph -"QTextEdit::removeSelectedText" ntqtextedit.html#removeSelectedText -"QTextEdit::removeSelection" ntqtextedit.html#removeSelection -"QTextEdit::repaintChanged" ntqtextedit.html#repaintChanged -"QTextEdit::returnPressed" ntqtextedit.html#returnPressed -"QTextEdit::scrollToAnchor" ntqtextedit.html#scrollToAnchor -"QTextEdit::scrollToBottom" ntqtextedit.html#scrollToBottom -"QTextEdit::selectAll" ntqtextedit.html#selectAll -"QTextEdit::selectedText" ntqtextedit.html#selectedText -"QTextEdit::selectedText" ntqtextedit.html#selectedText-prop -"QTextEdit::selectionChanged" ntqtextedit.html#selectionChanged -"QTextEdit::setAlignment" ntqtextedit.html#setAlignment -"QTextEdit::setAutoFormatting" ntqtextedit.html#setAutoFormatting -"QTextEdit::setBold" ntqtextedit.html#setBold -"QTextEdit::setColor" ntqtextedit.html#setColor -"QTextEdit::setCurrentFont" ntqtextedit.html#setCurrentFont -"QTextEdit::setCursorPosition" ntqtextedit.html#setCursorPosition -"QTextEdit::setFamily" ntqtextedit.html#setFamily -"QTextEdit::setItalic" ntqtextedit.html#setItalic -"QTextEdit::setLinkUnderline" ntqtextedit.html#setLinkUnderline -"QTextEdit::setMaxLogLines" ntqtextedit.html#setMaxLogLines -"QTextEdit::setMimeSourceFactory" ntqtextedit.html#setMimeSourceFactory -"QTextEdit::setModified" ntqtextedit.html#setModified -"QTextEdit::setOverwriteMode" ntqtextedit.html#setOverwriteMode -"QTextEdit::setPaper" ntqtextedit.html#setPaper -"QTextEdit::setParagraphBackgroundColor" ntqtextedit.html#setParagraphBackgroundColor -"QTextEdit::setPointSize" ntqtextedit.html#setPointSize -"QTextEdit::setReadOnly" ntqtextedit.html#setReadOnly -"QTextEdit::setSelection" ntqtextedit.html#setSelection -"QTextEdit::setSelectionAttributes" ntqtextedit.html#setSelectionAttributes -"QTextEdit::setStyleSheet" ntqtextedit.html#setStyleSheet -"QTextEdit::setTabChangesFocus" ntqtextedit.html#setTabChangesFocus -"QTextEdit::setTabStopWidth" ntqtextedit.html#setTabStopWidth -"QTextEdit::setText" ntqtextedit.html#setText -"QTextEdit::setTextFormat" ntqtextedit.html#setTextFormat -"QTextEdit::setUnderline" ntqtextedit.html#setUnderline -"QTextEdit::setUndoDepth" ntqtextedit.html#setUndoDepth -"QTextEdit::setUndoRedoEnabled" ntqtextedit.html#setUndoRedoEnabled -"QTextEdit::setVerticalAlignment" ntqtextedit.html#setVerticalAlignment -"QTextEdit::setWordWrap" ntqtextedit.html#setWordWrap -"QTextEdit::setWrapColumnOrWidth" ntqtextedit.html#setWrapColumnOrWidth -"QTextEdit::setWrapPolicy" ntqtextedit.html#setWrapPolicy -"QTextEdit::styleSheet" ntqtextedit.html#styleSheet -"QTextEdit::sync" ntqtextedit.html#sync -"QTextEdit::syntaxHighlighter" ntqtextedit.html#syntaxHighlighter -"QTextEdit::tabChangesFocus" ntqtextedit.html#tabChangesFocus -"QTextEdit::tabChangesFocus" ntqtextedit.html#tabChangesFocus-prop -"QTextEdit::tabStopWidth" ntqtextedit.html#tabStopWidth -"QTextEdit::tabStopWidth" ntqtextedit.html#tabStopWidth-prop -"QTextEdit::text" ntqtextedit.html#text -"QTextEdit::text" ntqtextedit.html#text-prop -"QTextEdit::textChanged" ntqtextedit.html#textChanged -"QTextEdit::textCursor" ntqtextedit.html#textCursor -"QTextEdit::textFormat" ntqtextedit.html#textFormat -"QTextEdit::textFormat" ntqtextedit.html#textFormat-prop -"QTextEdit::underline" ntqtextedit.html#underline -"QTextEdit::undo" ntqtextedit.html#undo -"QTextEdit::undoAvailable" ntqtextedit.html#undoAvailable -"QTextEdit::undoDepth" ntqtextedit.html#undoDepth -"QTextEdit::undoDepth" ntqtextedit.html#undoDepth-prop -"QTextEdit::undoRedoEnabled" ntqtextedit.html#undoRedoEnabled-prop -"QTextEdit::wordWrap" ntqtextedit.html#wordWrap -"QTextEdit::wordWrap" ntqtextedit.html#wordWrap-prop -"QTextEdit::wrapColumnOrWidth" ntqtextedit.html#wrapColumnOrWidth -"QTextEdit::wrapColumnOrWidth" ntqtextedit.html#wrapColumnOrWidth-prop -"QTextEdit::wrapPolicy" ntqtextedit.html#wrapPolicy -"QTextEdit::wrapPolicy" ntqtextedit.html#wrapPolicy-prop -"QTextEdit::zoomIn" ntqtextedit.html#zoomIn -"QTextEdit::zoomOut" ntqtextedit.html#zoomOut -"QTextEdit::zoomTo" ntqtextedit.html#zoomTo -"QTextEncoder" qtextencoder.html -"QTextEncoder::fromUnicode" qtextencoder.html#fromUnicode -"QTextEncoder::~QTextEncoder" qtextencoder.html#~QTextEncoder -"QTextIStream" qtextistream.html -"QTextOStream" qtextostream.html -"QTextStream" ntqtextstream.html -"QTextStream::Encoding" ntqtextstream.html#Encoding -"QTextStream::atEnd" ntqtextstream.html#atEnd -"QTextStream::codec" ntqtextstream.html#codec -"QTextStream::device" ntqtextstream.html#device -"QTextStream::fill" ntqtextstream.html#fill -"QTextStream::flags" ntqtextstream.html#flags -"QTextStream::operator<<" ntqtextstream.html#operator-lt-lt -"QTextStream::operator>>" ntqtextstream.html#operator-gt-gt -"QTextStream::precision" ntqtextstream.html#precision -"QTextStream::read" ntqtextstream.html#read -"QTextStream::readLine" ntqtextstream.html#readLine -"QTextStream::readRawBytes" ntqtextstream.html#readRawBytes -"QTextStream::reset" ntqtextstream.html#reset -"QTextStream::setCodec" ntqtextstream.html#setCodec -"QTextStream::setDevice" ntqtextstream.html#setDevice -"QTextStream::setEncoding" ntqtextstream.html#setEncoding -"QTextStream::setf" ntqtextstream.html#setf -"QTextStream::skipWhiteSpace" ntqtextstream.html#skipWhiteSpace -"QTextStream::ts_getbuf" ntqtextstream.html#ts_getbuf -"QTextStream::ts_getline" ntqtextstream.html#ts_getline -"QTextStream::ts_putc" ntqtextstream.html#ts_putc -"QTextStream::unsetDevice" ntqtextstream.html#unsetDevice -"QTextStream::unsetf" ntqtextstream.html#unsetf -"QTextStream::width" ntqtextstream.html#width -"QTextStream::writeRawBytes" ntqtextstream.html#writeRawBytes -"QTextStream::~QTextStream" ntqtextstream.html#~QTextStream -"QTextView::modified" ntqtextview.html#modified-prop -"QTextView::overwriteMode" ntqtextview.html#overwriteMode-prop -"QTextView::readOnly" ntqtextview.html#readOnly-prop -"QTextView::undoDepth" ntqtextview.html#undoDepth-prop -"QTextView::undoRedoEnabled" ntqtextview.html#undoRedoEnabled-prop +"TQTextBrowser" tqtextbrowser.html +"TQTextBrowser::anchorClicked" tqtextbrowser.html#anchorClicked +"TQTextBrowser::backward" tqtextbrowser.html#backward +"TQTextBrowser::backwardAvailable" tqtextbrowser.html#backwardAvailable +"TQTextBrowser::forward" tqtextbrowser.html#forward +"TQTextBrowser::forwardAvailable" tqtextbrowser.html#forwardAvailable +"TQTextBrowser::highlighted" tqtextbrowser.html#highlighted +"TQTextBrowser::home" tqtextbrowser.html#home +"TQTextBrowser::keyPressEvent" tqtextbrowser.html#keyPressEvent +"TQTextBrowser::linkClicked" tqtextbrowser.html#linkClicked +"TQTextBrowser::modified" tqtextbrowser.html#modified-prop +"TQTextBrowser::overwriteMode" tqtextbrowser.html#overwriteMode-prop +"TQTextBrowser::readOnly" tqtextbrowser.html#readOnly-prop +"TQTextBrowser::reload" tqtextbrowser.html#reload +"TQTextBrowser::setSource" tqtextbrowser.html#setSource +"TQTextBrowser::setText" tqtextbrowser.html#setText +"TQTextBrowser::source" tqtextbrowser.html#source +"TQTextBrowser::source" tqtextbrowser.html#source-prop +"TQTextBrowser::sourceChanged" tqtextbrowser.html#sourceChanged +"TQTextBrowser::undoDepth" tqtextbrowser.html#undoDepth-prop +"TQTextBrowser::undoRedoEnabled" tqtextbrowser.html#undoRedoEnabled-prop +"TQTextCodec" tqtextcodec.html +"TQTextCodec::canEncode" tqtextcodec.html#canEncode +"TQTextCodec::codecForCStrings" tqtextcodec.html#codecForCStrings +"TQTextCodec::codecForContent" tqtextcodec.html#codecForContent +"TQTextCodec::codecForIndex" tqtextcodec.html#codecForIndex +"TQTextCodec::codecForLocale" tqtextcodec.html#codecForLocale +"TQTextCodec::codecForMib" tqtextcodec.html#codecForMib +"TQTextCodec::codecForName" tqtextcodec.html#codecForName +"TQTextCodec::codecForTr" tqtextcodec.html#codecForTr +"TQTextCodec::deleteAllCodecs" tqtextcodec.html#deleteAllCodecs +"TQTextCodec::fromUnicode" tqtextcodec.html#fromUnicode +"TQTextCodec::heuristicContentMatch" tqtextcodec.html#heuristicContentMatch +"TQTextCodec::heuristicNameMatch" tqtextcodec.html#heuristicNameMatch +"TQTextCodec::loadCharmap" tqtextcodec.html#loadCharmap +"TQTextCodec::loadCharmapFile" tqtextcodec.html#loadCharmapFile +"TQTextCodec::locale" tqtextcodec.html#locale +"TQTextCodec::makeDecoder" tqtextcodec.html#makeDecoder +"TQTextCodec::makeEncoder" tqtextcodec.html#makeEncoder +"TQTextCodec::mibEnum" tqtextcodec.html#mibEnum +"TQTextCodec::mimeName" tqtextcodec.html#mimeName +"TQTextCodec::name" tqtextcodec.html#name +"TQTextCodec::setCodecForCStrings" tqtextcodec.html#setCodecForCStrings +"TQTextCodec::setCodecForLocale" tqtextcodec.html#setCodecForLocale +"TQTextCodec::setCodecForTr" tqtextcodec.html#setCodecForTr +"TQTextCodec::simpleHeuristicNameMatch" tqtextcodec.html#simpleHeuristicNameMatch +"TQTextCodec::toUnicode" tqtextcodec.html#toUnicode +"TQTextCodec::~TQTextCodec" tqtextcodec.html#~TQTextCodec +"TQTextCodecPlugin" tqtextcodecplugin.html +"TQTextCodecPlugin::createForMib" tqtextcodecplugin.html#createForMib +"TQTextCodecPlugin::createForName" tqtextcodecplugin.html#createForName +"TQTextCodecPlugin::mibEnums" tqtextcodecplugin.html#mibEnums +"TQTextCodecPlugin::names" tqtextcodecplugin.html#names +"TQTextCodecPlugin::~TQTextCodecPlugin" tqtextcodecplugin.html#~TQTextCodecPlugin +"TQTextDecoder" tqtextdecoder.html +"TQTextDecoder::toUnicode" tqtextdecoder.html#toUnicode +"TQTextDecoder::~TQTextDecoder" tqtextdecoder.html#~TQTextDecoder +"TQTextDrag" tqtextdrag.html +"TQTextDrag::canDecode" tqtextdrag.html#canDecode +"TQTextDrag::decode" tqtextdrag.html#decode +"TQTextDrag::setSubtype" tqtextdrag.html#setSubtype +"TQTextDrag::setText" tqtextdrag.html#setText +"TQTextDrag::~TQTextDrag" tqtextdrag.html#~TQTextDrag +"TQTextEdit" tqtextedit.html +"TQTextEdit::AutoFormatting" tqtextedit.html#AutoFormatting +"TQTextEdit::CursorAction" tqtextedit.html#CursorAction +"TQTextEdit::KeyboardAction" tqtextedit.html#KeyboardAction +"TQTextEdit::VerticalAlignment" tqtextedit.html#VerticalAlignment +"TQTextEdit::WordWrap" tqtextedit.html#WordWrap +"TQTextEdit::WrapPolicy" tqtextedit.html#WrapPolicy +"TQTextEdit::alignment" tqtextedit.html#alignment +"TQTextEdit::anchorAt" tqtextedit.html#anchorAt +"TQTextEdit::append" tqtextedit.html#append +"TQTextEdit::autoFormatting" tqtextedit.html#autoFormatting +"TQTextEdit::autoFormatting" tqtextedit.html#autoFormatting-prop +"TQTextEdit::bold" tqtextedit.html#bold +"TQTextEdit::charAt" tqtextedit.html#charAt +"TQTextEdit::clear" tqtextedit.html#clear +"TQTextEdit::clearParagraphBackground" tqtextedit.html#clearParagraphBackground +"TQTextEdit::clicked" tqtextedit.html#clicked +"TQTextEdit::color" tqtextedit.html#color +"TQTextEdit::context" tqtextedit.html#context +"TQTextEdit::copy" tqtextedit.html#copy +"TQTextEdit::copyAvailable" tqtextedit.html#copyAvailable +"TQTextEdit::createPopupMenu" tqtextedit.html#createPopupMenu +"TQTextEdit::currentAlignmentChanged" tqtextedit.html#currentAlignmentChanged +"TQTextEdit::currentColorChanged" tqtextedit.html#currentColorChanged +"TQTextEdit::currentFont" tqtextedit.html#currentFont +"TQTextEdit::currentFontChanged" tqtextedit.html#currentFontChanged +"TQTextEdit::currentVerticalAlignmentChanged" tqtextedit.html#currentVerticalAlignmentChanged +"TQTextEdit::cursorPositionChanged" tqtextedit.html#cursorPositionChanged +"TQTextEdit::cut" tqtextedit.html#cut +"TQTextEdit::del" tqtextedit.html#del +"TQTextEdit::doKeyboardAction" tqtextedit.html#doKeyboardAction +"TQTextEdit::documentTitle" tqtextedit.html#documentTitle +"TQTextEdit::documentTitle" tqtextedit.html#documentTitle-prop +"TQTextEdit::doubleClicked" tqtextedit.html#doubleClicked +"TQTextEdit::ensureCursorVisible" tqtextedit.html#ensureCursorVisible +"TQTextEdit::family" tqtextedit.html#family +"TQTextEdit::find" tqtextedit.html#find +"TQTextEdit::focusNextPrevChild" tqtextedit.html#focusNextPrevChild +"TQTextEdit::getCursorPosition" tqtextedit.html#getCursorPosition +"TQTextEdit::getSelection" tqtextedit.html#getSelection +"TQTextEdit::hasSelectedText" tqtextedit.html#hasSelectedText +"TQTextEdit::hasSelectedText" tqtextedit.html#hasSelectedText-prop +"TQTextEdit::heightForWidth" tqtextedit.html#heightForWidth +"TQTextEdit::insert" tqtextedit.html#insert +"TQTextEdit::insertAt" tqtextedit.html#insertAt +"TQTextEdit::insertParagraph" tqtextedit.html#insertParagraph +"TQTextEdit::isModified" tqtextedit.html#isModified +"TQTextEdit::isOverwriteMode" tqtextedit.html#isOverwriteMode +"TQTextEdit::isReadOnly" tqtextedit.html#isReadOnly +"TQTextEdit::isRedoAvailable" tqtextedit.html#isRedoAvailable +"TQTextEdit::isUndoAvailable" tqtextedit.html#isUndoAvailable +"TQTextEdit::isUndoRedoEnabled" tqtextedit.html#isUndoRedoEnabled +"TQTextEdit::italic" tqtextedit.html#italic +"TQTextEdit::keyPressEvent" tqtextedit.html#keyPressEvent +"TQTextEdit::length" tqtextedit.html#length +"TQTextEdit::length" tqtextedit.html#length-prop +"TQTextEdit::lineOfChar" tqtextedit.html#lineOfChar +"TQTextEdit::lines" tqtextedit.html#lines +"TQTextEdit::linesOfParagraph" tqtextedit.html#linesOfParagraph +"TQTextEdit::linkUnderline" tqtextedit.html#linkUnderline +"TQTextEdit::linkUnderline" tqtextedit.html#linkUnderline-prop +"TQTextEdit::maxLogLines" tqtextedit.html#maxLogLines +"TQTextEdit::mimeSourceFactory" tqtextedit.html#mimeSourceFactory +"TQTextEdit::modificationChanged" tqtextedit.html#modificationChanged +"TQTextEdit::modified" tqtextedit.html#modified-prop +"TQTextEdit::moveCursor" tqtextedit.html#moveCursor +"TQTextEdit::optimCheckLimit" tqtextedit.html#optimCheckLimit +"TQTextEdit::overwriteMode" tqtextedit.html#overwriteMode-prop +"TQTextEdit::paper" tqtextedit.html#paper +"TQTextEdit::paper" tqtextedit.html#paper-prop +"TQTextEdit::paragraphAt" tqtextedit.html#paragraphAt +"TQTextEdit::paragraphBackgroundColor" tqtextedit.html#paragraphBackgroundColor +"TQTextEdit::paragraphLength" tqtextedit.html#paragraphLength +"TQTextEdit::paragraphRect" tqtextedit.html#paragraphRect +"TQTextEdit::paragraphs" tqtextedit.html#paragraphs +"TQTextEdit::paste" tqtextedit.html#paste +"TQTextEdit::pasteSpecial" tqtextedit.html#pasteSpecial +"TQTextEdit::pasteSubType" tqtextedit.html#pasteSubType +"TQTextEdit::placeCursor" tqtextedit.html#placeCursor +"TQTextEdit::pointSize" tqtextedit.html#pointSize +"TQTextEdit::readOnly" tqtextedit.html#readOnly-prop +"TQTextEdit::redo" tqtextedit.html#redo +"TQTextEdit::redoAvailable" tqtextedit.html#redoAvailable +"TQTextEdit::removeParagraph" tqtextedit.html#removeParagraph +"TQTextEdit::removeSelectedText" tqtextedit.html#removeSelectedText +"TQTextEdit::removeSelection" tqtextedit.html#removeSelection +"TQTextEdit::repaintChanged" tqtextedit.html#repaintChanged +"TQTextEdit::returnPressed" tqtextedit.html#returnPressed +"TQTextEdit::scrollToAnchor" tqtextedit.html#scrollToAnchor +"TQTextEdit::scrollToBottom" tqtextedit.html#scrollToBottom +"TQTextEdit::selectAll" tqtextedit.html#selectAll +"TQTextEdit::selectedText" tqtextedit.html#selectedText +"TQTextEdit::selectedText" tqtextedit.html#selectedText-prop +"TQTextEdit::selectionChanged" tqtextedit.html#selectionChanged +"TQTextEdit::setAlignment" tqtextedit.html#setAlignment +"TQTextEdit::setAutoFormatting" tqtextedit.html#setAutoFormatting +"TQTextEdit::setBold" tqtextedit.html#setBold +"TQTextEdit::setColor" tqtextedit.html#setColor +"TQTextEdit::setCurrentFont" tqtextedit.html#setCurrentFont +"TQTextEdit::setCursorPosition" tqtextedit.html#setCursorPosition +"TQTextEdit::setFamily" tqtextedit.html#setFamily +"TQTextEdit::setItalic" tqtextedit.html#setItalic +"TQTextEdit::setLinkUnderline" tqtextedit.html#setLinkUnderline +"TQTextEdit::setMaxLogLines" tqtextedit.html#setMaxLogLines +"TQTextEdit::setMimeSourceFactory" tqtextedit.html#setMimeSourceFactory +"TQTextEdit::setModified" tqtextedit.html#setModified +"TQTextEdit::setOverwriteMode" tqtextedit.html#setOverwriteMode +"TQTextEdit::setPaper" tqtextedit.html#setPaper +"TQTextEdit::setParagraphBackgroundColor" tqtextedit.html#setParagraphBackgroundColor +"TQTextEdit::setPointSize" tqtextedit.html#setPointSize +"TQTextEdit::setReadOnly" tqtextedit.html#setReadOnly +"TQTextEdit::setSelection" tqtextedit.html#setSelection +"TQTextEdit::setSelectionAttributes" tqtextedit.html#setSelectionAttributes +"TQTextEdit::setStyleSheet" tqtextedit.html#setStyleSheet +"TQTextEdit::setTabChangesFocus" tqtextedit.html#setTabChangesFocus +"TQTextEdit::setTabStopWidth" tqtextedit.html#setTabStopWidth +"TQTextEdit::setText" tqtextedit.html#setText +"TQTextEdit::setTextFormat" tqtextedit.html#setTextFormat +"TQTextEdit::setUnderline" tqtextedit.html#setUnderline +"TQTextEdit::setUndoDepth" tqtextedit.html#setUndoDepth +"TQTextEdit::setUndoRedoEnabled" tqtextedit.html#setUndoRedoEnabled +"TQTextEdit::setVerticalAlignment" tqtextedit.html#setVerticalAlignment +"TQTextEdit::setWordWrap" tqtextedit.html#setWordWrap +"TQTextEdit::setWrapColumnOrWidth" tqtextedit.html#setWrapColumnOrWidth +"TQTextEdit::setWrapPolicy" tqtextedit.html#setWrapPolicy +"TQTextEdit::styleSheet" tqtextedit.html#styleSheet +"TQTextEdit::sync" tqtextedit.html#sync +"TQTextEdit::syntaxHighlighter" tqtextedit.html#syntaxHighlighter +"TQTextEdit::tabChangesFocus" tqtextedit.html#tabChangesFocus +"TQTextEdit::tabChangesFocus" tqtextedit.html#tabChangesFocus-prop +"TQTextEdit::tabStopWidth" tqtextedit.html#tabStopWidth +"TQTextEdit::tabStopWidth" tqtextedit.html#tabStopWidth-prop +"TQTextEdit::text" tqtextedit.html#text +"TQTextEdit::text" tqtextedit.html#text-prop +"TQTextEdit::textChanged" tqtextedit.html#textChanged +"TQTextEdit::textCursor" tqtextedit.html#textCursor +"TQTextEdit::textFormat" tqtextedit.html#textFormat +"TQTextEdit::textFormat" tqtextedit.html#textFormat-prop +"TQTextEdit::underline" tqtextedit.html#underline +"TQTextEdit::undo" tqtextedit.html#undo +"TQTextEdit::undoAvailable" tqtextedit.html#undoAvailable +"TQTextEdit::undoDepth" tqtextedit.html#undoDepth +"TQTextEdit::undoDepth" tqtextedit.html#undoDepth-prop +"TQTextEdit::undoRedoEnabled" tqtextedit.html#undoRedoEnabled-prop +"TQTextEdit::wordWrap" tqtextedit.html#wordWrap +"TQTextEdit::wordWrap" tqtextedit.html#wordWrap-prop +"TQTextEdit::wrapColumnOrWidth" tqtextedit.html#wrapColumnOrWidth +"TQTextEdit::wrapColumnOrWidth" tqtextedit.html#wrapColumnOrWidth-prop +"TQTextEdit::wrapPolicy" tqtextedit.html#wrapPolicy +"TQTextEdit::wrapPolicy" tqtextedit.html#wrapPolicy-prop +"TQTextEdit::zoomIn" tqtextedit.html#zoomIn +"TQTextEdit::zoomOut" tqtextedit.html#zoomOut +"TQTextEdit::zoomTo" tqtextedit.html#zoomTo +"TQTextEncoder" tqtextencoder.html +"TQTextEncoder::fromUnicode" tqtextencoder.html#fromUnicode +"TQTextEncoder::~TQTextEncoder" tqtextencoder.html#~TQTextEncoder +"TQTextIStream" tqtextistream.html +"TQTextOStream" tqtextostream.html +"TQTextStream" tqtextstream.html +"TQTextStream::Encoding" tqtextstream.html#Encoding +"TQTextStream::atEnd" tqtextstream.html#atEnd +"TQTextStream::codec" tqtextstream.html#codec +"TQTextStream::device" tqtextstream.html#device +"TQTextStream::fill" tqtextstream.html#fill +"TQTextStream::flags" tqtextstream.html#flags +"TQTextStream::operator<<" tqtextstream.html#operator-lt-lt +"TQTextStream::operator>>" tqtextstream.html#operator-gt-gt +"TQTextStream::precision" tqtextstream.html#precision +"TQTextStream::read" tqtextstream.html#read +"TQTextStream::readLine" tqtextstream.html#readLine +"TQTextStream::readRawBytes" tqtextstream.html#readRawBytes +"TQTextStream::reset" tqtextstream.html#reset +"TQTextStream::setCodec" tqtextstream.html#setCodec +"TQTextStream::setDevice" tqtextstream.html#setDevice +"TQTextStream::setEncoding" tqtextstream.html#setEncoding +"TQTextStream::setf" tqtextstream.html#setf +"TQTextStream::skipWhiteSpace" tqtextstream.html#skipWhiteSpace +"TQTextStream::ts_getbuf" tqtextstream.html#ts_getbuf +"TQTextStream::ts_getline" tqtextstream.html#ts_getline +"TQTextStream::ts_putc" tqtextstream.html#ts_putc +"TQTextStream::unsetDevice" tqtextstream.html#unsetDevice +"TQTextStream::unsetf" tqtextstream.html#unsetf +"TQTextStream::width" tqtextstream.html#width +"TQTextStream::writeRawBytes" tqtextstream.html#writeRawBytes +"TQTextStream::~TQTextStream" tqtextstream.html#~TQTextStream +"TQTextView::modified" tqtextview.html#modified-prop +"TQTextView::overwriteMode" tqtextview.html#overwriteMode-prop +"TQTextView::readOnly" tqtextview.html#readOnly-prop +"TQTextView::undoDepth" tqtextview.html#undoDepth-prop +"TQTextView::undoRedoEnabled" tqtextview.html#undoRedoEnabled-prop "QThread" ntqthread.html "QThread::Priority" ntqthread.html#Priority "QThread::currentThread" ntqthread.html#currentThread diff --git a/doc/html/io.html b/doc/html/io.html index 758080ef..367b03c8 100644 --- a/doc/html/io.html +++ b/doc/html/io.html @@ -65,9 +65,9 @@ devices, processes, files etc. as well as manipulating files and directories.
    TQSocketBuffered TCP connection
    TQSocketDevicePlatform-independent low-level socket API
    TQSocketNotifierSupport for socket callbacks -
    TQTextIStreamConvenience class for input streams -
    TQTextOStreamConvenience class for output streams -
    TQTextStreamBasic functions for reading and writing text using a TQIODevice +
    TQTextIStreamConvenience class for input streams +
    TQTextOStreamConvenience class for output streams +
    TQTextStreamBasic functions for reading and writing text using a TQIODevice
    TQUrlURL parser and simplifies working with URLs
    TQUrlInfoStores information about URLs
    TQUrlOperatorCommon operations on URLs diff --git a/doc/html/keyfeatures30.html b/doc/html/keyfeatures30.html index 7583e2a5..52b0b8ba 100644 --- a/doc/html/keyfeatures30.html +++ b/doc/html/keyfeatures30.html @@ -54,7 +54,7 @@ languages.

    Many new classes have been added to the TQt Library. Amongst them are classes that provide a docking architecture (TQDockArea/TQDockWindow), a powerful rich text editor -(TQTextEdit), a class to store and access application settings +(TQTextEdit), a class to store and access application settings (TQSettings) and a class to create and communicate with processes (TQProcess).

    Apart from the changes in the library itself a lot has been done to @@ -115,7 +115,7 @@ optimized and extended to support editing. It allows editing formatted text with different fonts, colors, paragraph styles, tables and images. The editor supports different word wrap modes, command-based undo/redo, multiple selections, drag and drop, and many other -features. The new TQTextEdit engine is highly optimized for proccesing +features. The new TQTextEdit engine is highly optimized for proccesing and displaying large documents quickly and efficiently.

    Unicode

    diff --git a/doc/html/layout-example.html b/doc/html/layout-example.html index c178ef5f..4a2ab99d 100644 --- a/doc/html/layout-example.html +++ b/doc/html/layout-example.html @@ -116,7 +116,7 @@ public: // Make a big widget that will grab all space in the middle. TQMultiLineEdit *bigWidget = new TQMultiLineEdit( this ); - bigWidget->setText( "This widget will get all the remaining space" ); + bigWidget->setText( "This widget will get all the remaining space" ); bigWidget->setFrameStyle( TQFrame::Panel | TQFrame::Plain ); // Set vertical stretch factor to 10 to let the bigWidget stretch diff --git a/doc/html/linguist-manual-2.html b/doc/html/linguist-manual-2.html index 19db9a40..468f38a4 100644 --- a/doc/html/linguist-manual-2.html +++ b/doc/html/linguist-manual-2.html @@ -52,8 +52,8 @@ body { background: #ffffff; color: black; } superapp_no.ts \ superapp_se.ts -

    TQTextCodec::setCodecForTr() makes it possible to choose a 8-bit encoding for literal strings that appear within tr() calls. This is useful for applications whose source language is, for example, Chinese or Japanese. If no encoding is set, tr() uses Latin-1.

    -

    If you do use the TQTextCodec::codecForTr() mechanism in your application, TQt Linguist needs you to set the DEFAULTCODEC entry in the .pro file as well. For example:

    +

    TQTextCodec::setCodecForTr() makes it possible to choose a 8-bit encoding for literal strings that appear within tr() calls. This is useful for applications whose source language is, for example, Chinese or Japanese. If no encoding is set, tr() uses Latin-1.

    +

    If you do use the TQTextCodec::codecForTr() mechanism in your application, TQt Linguist needs you to set the DEFAULTCODEC entry in the .pro file as well. For example:

         DEFAULTCODEC    = ISO-8859-5
     
    diff --git a/doc/html/linguist-manual-4.html b/doc/html/linguist-manual-4.html index d1cb45ed..f50dbe17 100644 --- a/doc/html/linguist-manual-4.html +++ b/doc/html/linguist-manual-4.html @@ -345,7 +345,7 @@ TRANSLATIONS = tt2_fr.ts \ translator.load( TQString("tt2_") + TQTextCodec::locale(), "." ); app.installTranslator( &translator ); -

    We choose which translation to use according to the current locale. TQTextCodec::locale() can be influenced by setting the LANG environment variable, for example. Notice that the use of a naming convention that incorporates the locale for .qm message files, (and .ts files), makes it easy to implement choosing the translation file according to locale.

    +

    We choose which translation to use according to the current locale. TQTextCodec::locale() can be influenced by setting the LANG environment variable, for example. Notice that the use of a naming convention that incorporates the locale for .qm message files, (and .ts files), makes it easy to implement choosing the translation file according to locale.

    If there is no .qm message file for the locale chosen the original source text will be used and no error raised.

    Translating to French and Dutch

    We'll begin by translating the example application into French. Start TQt Linguist with tt2_fr.ts. You should get the seven source texts ("&Up", "&Left", etc.) grouped in two contexts ("ArrowPad" and "MainWindow").

    diff --git a/doc/html/mail-example.html b/doc/html/mail-example.html index acd2640e..0ac4f8d9 100644 --- a/doc/html/mail-example.html +++ b/doc/html/mail-example.html @@ -90,7 +90,7 @@ private: TQString from; TQString rcpt; TQSocket *socket; - TQTextStream * t; + TQTextStream * t; int state; TQString response; TQDns * mxLookup; @@ -113,7 +113,7 @@ private: #include "smtp.h" -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqsocket.h> #include <ntqdns.h> #include <ntqtimer.h> @@ -171,7 +171,7 @@ void Smtp::dnsLookupHelper() emit status( tr( "Connecting to %1" ).arg( s.first().name ) ); socket->connectToHost( s.first().name, 25 ); - t = new TQTextStream( socket ); + t = new TQTextStream( socket ); } diff --git a/doc/html/mainclasses.html b/doc/html/mainclasses.html index 17fcb4a8..0102955b 100644 --- a/doc/html/mainclasses.html +++ b/doc/html/mainclasses.html @@ -221,7 +221,7 @@ classes), see TQt's Classes.
    TQRect -TQTextBrowser +TQTextBrowser TQWidgetStack
    TQRegExp -TQTextEdit +TQTextEdit TQWizard
    S TQScrollView -TQTextStream +TQTextStream TQWorkspace
    - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextBrowser Class Reference

    - -

    The TQTextBrowser class provides a rich text browser with hypertext navigation. -More... -

    #include <ntqtextbrowser.h> -

    Inherits TQTextEdit. -

    List of all member functions. -

    Public Members

    -
      -
    • TQTextBrowser ( TQWidget * parent = 0, const char * name = 0 )
    • -
    • TQString source () const
    • -
    -

    Public Slots

    - -

    Signals

    - -

    Properties

    -
      -
    • bool modified - whether the contents have been modified  (read only)
    • -
    • bool overwriteMode - this text browser's overwrite mode  (read only)
    • -
    • bool readOnly - whether the contents are read only  (read only)
    • -
    • TQString source - the name of the displayed document
    • -
    • int undoDepth - this text browser's undo depth  (read only)
    • -
    • bool undoRedoEnabled - whether undo and redo are enabled  (read only)
    • -
    -

    Protected Members

    - -

    Detailed Description

    - - -The TQTextBrowser class provides a rich text browser with hypertext navigation. -

    - - - -

    This class extends TQTextEdit (in read-only mode), adding some -navigation functionality so that users can follow links in -hypertext documents. The contents of TQTextEdit is set with -setText(), but TQTextBrowser has an additional function, -setSource(), which makes it possible to set the text to a named -document. The name is looked up in the text view's mime source -factory. If a document name ends with an anchor (for example, "#anchor"), the text browser automatically scrolls to that position -(using scrollToAnchor()). When the user clicks on a hyperlink, the -browser will call setSource() itself, with the link's href -value as argument. You can track the current source by connetion -to the sourceChanged() signal. -

    TQTextBrowser provides backward() and forward() slots which you can -use to implement Back and Forward buttons. The home() slot sets -the text to the very first document displayed. The linkClicked() -signal is emitted when the user clicks a link. -

    By using TQTextEdit::setMimeSourceFactory() you can provide your -own subclass of TQMimeSourceFactory. This makes it possible to -access data from anywhere, for example from a network or from a -database. See TQMimeSourceFactory::data() for details. -

    If you intend using the mime factory to read the data directly -from the file system, you may have to specify the encoding for the -file extension you are using. For example: -

    -    mimeSourceFactory()->setExtensionType("qml", "text/utf8");
    -    
    - -This is to ensure that the factory is able to resolve the document -names. -

    TQTextBrowser interprets the tags it processes in accordance with -the default style sheet. Change the style sheet with -setStyleSheet(); see TQStyleSheet for details. -

    If you want to provide your users with editable rich text use -TQTextEdit. If you want a text browser without hypertext navigation -use TQTextEdit, and use TQTextEdit::setReadOnly() to disable -editing. If you just need to display a small piece of rich text -use TQSimpleRichText or TQLabel. -

    -

    See also Advanced Widgets, Help System, and Text Related Classes. - -


    Member Function Documentation

    -

    TQTextBrowser::TQTextBrowser ( TQWidget * parent = 0, const char * name = 0 ) -

    -Constructs an empty TQTextBrowser called name, with parent parent. - -

    void TQTextBrowser::anchorClicked ( const TQString & name, const TQString & link ) [signal] -

    - -

    This signal is emitted when the user clicks an anchor. The link is -the value of the href i.e. the name of the target document. The name -is the name of the anchor. -

    See also linkClicked(). - -

    void TQTextBrowser::backward () [virtual slot] -

    -Changes the document displayed to the previous document in the -list of documents built by navigating links. Does nothing if there -is no previous document. -

    See also forward() and backwardAvailable(). - -

    Example: helpviewer/helpwindow.cpp. -

    void TQTextBrowser::backwardAvailable ( bool available ) [signal] -

    - -

    This signal is emitted when the availability of backward() -changes. available is FALSE when the user is at home(); -otherwise it is TRUE. - -

    Example: helpviewer/helpwindow.cpp. -

    void TQTextBrowser::forward () [virtual slot] -

    -Changes the document displayed to the next document in the list of -documents built by navigating links. Does nothing if there is no -next document. -

    See also backward() and forwardAvailable(). - -

    Example: helpviewer/helpwindow.cpp. -

    void TQTextBrowser::forwardAvailable ( bool available ) [signal] -

    - -

    This signal is emitted when the availability of forward() changes. -available is TRUE after the user navigates backward() and FALSE -when the user navigates or goes forward(). - -

    Example: helpviewer/helpwindow.cpp. -

    void TQTextBrowser::highlighted ( const TQString & link ) [signal] -

    -

    This signal is emitted when the user has selected but not -activated a link in the document. link is the value of the href i.e. the name of the target document. - -

    Example: helpviewer/helpwindow.cpp. -

    void TQTextBrowser::home () [virtual slot] -

    -Changes the document displayed to be the first document the -browser displayed. - -

    Example: helpviewer/helpwindow.cpp. -

    void TQTextBrowser::keyPressEvent ( TQKeyEvent * e ) [virtual protected] -

    -The event e is used to provide the following keyboard shortcuts: -
    -
    Keypress Action -
    Alt+Left Arrow backward() -
    Alt+Right Arrow forward() -
    Alt+Up Arrow home() -
    - -

    Reimplemented from TQTextEdit. -

    void TQTextBrowser::linkClicked ( const TQString & link ) [signal] -

    - -

    This signal is emitted when the user clicks a link. The link is -the value of the href i.e. the name of the target document. -

    The link will be the absolute location of the document, based -on the value of the anchor's href tag and the current context of -the document. -

    See also anchorClicked() and context(). - -

    void TQTextBrowser::reload () [virtual slot] -

    -Reloads the current set source. - -

    void TQTextBrowser::setSource ( const TQString & name ) [virtual slot] -

    Sets the name of the displayed document to name. -See the "source" property for details. -

    TQString TQTextBrowser::source () const -

    Returns the name of the displayed document. -See the "source" property for details. -

    void TQTextBrowser::sourceChanged ( const TQString & src ) [signal] -

    - -

    This signal is emitted when the mime source has changed, src -being the new source. -

    Source changes happen both programmatically when calling -setSource(), forward(), backword() or home() or when the user -clicks on links or presses the equivalent key sequences. - -

    Example: helpviewer/helpwindow.cpp. -


    Property Documentation

    -

    bool modified

    -

    This property holds whether the contents have been modified. -

    -

    bool overwriteMode

    -

    This property holds this text browser's overwrite mode. -

    -

    bool readOnly

    -

    This property holds whether the contents are read only. -

    -

    TQString source

    -

    This property holds the name of the displayed document. -

    This is a TQString::null if no document is displayed or if the -source is unknown. -

    Setting this property uses the mimeSourceFactory() to lookup the -named document. It also checks for optional anchors and scrolls -the document accordingly. -

    If the first tag in the document is <qt type=detail>, the -document is displayed as a popup rather than as new document in -the browser window itself. Otherwise, the document is displayed -normally in the text browser with the text set to the contents of -the named document with setText(). -

    If you are using the filesystem access capabilities of the mime -source factory, you must ensure that the factory knows about the -encoding of specified files; otherwise no data will be available. -The default factory handles a couple of common file extensions -such as *.html and *.txt with reasonable defaults. See -TQMimeSourceFactory::data() for details. - -

    Set this property's value with setSource() and get this property's value with source(). -

    int undoDepth

    -

    This property holds this text browser's undo depth. -

    -

    bool undoRedoEnabled

    -

    This property holds whether undo and redo are enabled. -

    -

    -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqtextcodec.html b/doc/html/ntqtextcodec.html deleted file mode 100644 index 0cec4ec2..00000000 --- a/doc/html/ntqtextcodec.html +++ /dev/null @@ -1,611 +0,0 @@ - - - - - -TQTextCodec Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextCodec Class Reference

    - -

    The TQTextCodec class provides conversion between text encodings. -More... -

    Almost all the functions in this class are reentrant when TQt is built with thread support. The exceptions are ~TQTextCodec(), setCodecForTr(), setCodecForCStrings(), and TQTextCodec(). -

    #include <ntqtextcodec.h> -

    Inherited by TQBig5Codec, TQBig5hkscsCodec, TQEucJpCodec, TQEucKrCodec, TQGb18030Codec, TQJisCodec, TQHebrewCodec, TQSjisCodec, and TQTsciiCodec. -

    List of all member functions. -

    Public Members

    -
      -
    • virtual ~TQTextCodec ()
    • -
    • virtual const char * name () const = 0
    • -
    • virtual const char * mimeName () const
    • -
    • virtual int mibEnum () const = 0
    • -
    • virtual TQTextDecoder * makeDecoder () const
    • -
    • virtual TQTextEncoder * makeEncoder () const
    • -
    • virtual TQString toUnicode ( const char * chars, int len ) const
    • -
    • virtual TQCString fromUnicode ( const TQString & uc, int & lenInOut ) const
    • -
    • TQCString fromUnicode ( const TQString & uc ) const
    • -
    • TQString toUnicode ( const TQByteArray & a, int len ) const
    • -
    • TQString toUnicode ( const TQByteArray & a ) const
    • -
    • TQString toUnicode ( const TQCString & a, int len ) const
    • -
    • TQString toUnicode ( const TQCString & a ) const
    • -
    • TQString toUnicode ( const char * chars ) const
    • -
    • virtual bool canEncode ( TQChar ch ) const
    • -
    • virtual bool canEncode ( const TQString & s ) const
    • -
    • virtual int heuristicContentMatch ( const char * chars, int len ) const = 0
    • -
    • virtual int heuristicNameMatch ( const char * hint ) const
    • -
    -

    Static Public Members

    - -

    Protected Members

    - -

    Static Protected Members

    - -

    Detailed Description

    - - -The TQTextCodec class provides conversion between text encodings. - - -

    TQt uses Unicode to store, draw and manipulate strings. In many -situations you may wish to deal with data that uses a different -encoding. For example, most Japanese documents are still stored in -Shift-JIS or ISO2022, while Russian users often have their -documents in KOI8-R or CP1251. -

    TQt provides a set of TQTextCodec classes to help with converting -non-Unicode formats to and from Unicode. You can also create your -own codec classes (see later). -

    The supported encodings are: -

      -
    • Latin1 -
    • Big5 -- Chinese -
    • Big5-HKSCS -- Chinese -
    • eucJP -- Japanese -
    • eucKR -- Korean -
    • GB2312 -- Chinese -
    • GBK -- Chinese -
    • GB18030 -- Chinese -
    • JIS7 -- Japanese -
    • Shift-JIS -- Japanese -
    • TSCII -- Tamil -
    • utf8 -- Unicode, 8-bit -
    • utf16 -- Unicode -
    • KOI8-R -- Russian -
    • KOI8-U -- Ukrainian -
    • ISO8859-1 -- Western -
    • ISO8859-2 -- Central European -
    • ISO8859-3 -- Central European -
    • ISO8859-4 -- Baltic -
    • ISO8859-5 -- Cyrillic -
    • ISO8859-6 -- Arabic -
    • ISO8859-7 -- Greek -
    • ISO8859-8 -- Hebrew, visually ordered -
    • ISO8859-8-i -- Hebrew, logically ordered -
    • ISO8859-9 -- Turkish -
    • ISO8859-10 -
    • ISO8859-13 -
    • ISO8859-14 -
    • ISO8859-15 -- Western -
    • IBM 850 -
    • IBM 866 -
    • CP874 -
    • CP1250 -- Central European -
    • CP1251 -- Cyrillic -
    • CP1252 -- Western -
    • CP1253 -- Greek -
    • CP1254 -- Turkish -
    • CP1255 -- Hebrew -
    • CP1256 -- Arabic -
    • CP1257 -- Baltic -
    • CP1258 -
    • Apple Roman -
    • TIS-620 -- Thai -
    -

    TQTextCodecs can be used as follows to convert some locally encoded -string to Unicode. Suppose you have some string encoded in Russian -KOI8-R encoding, and want to convert it to Unicode. The simple way -to do this is: -

    -    TQCString locallyEncoded = "..."; // text to convert
    -    TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R
    -    TQString unicodeString = codec->toUnicode( locallyEncoded );
    -    
    - -

    After this, unicodeString holds the text converted to Unicode. -Converting a string from Unicode to the local encoding is just as -easy: -

    -    TQString unicodeString = "..."; // any Unicode text
    -    TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R
    -    TQCString locallyEncoded = codec->fromUnicode( unicodeString );
    -    
    - -

    Some care must be taken when trying to convert the data in chunks, -for example, when receiving it over a network. In such cases it is -possible that a multi-byte character will be split over two -chunks. At best this might result in the loss of a character and -at worst cause the entire conversion to fail. -

    The approach to use in these situations is to create a TQTextDecoder -object for the codec and use this TQTextDecoder for the whole -decoding process, as shown below: -

    -    TQTextCodec *codec = TQTextCodec::codecForName( "Shift-JIS" );
    -    TQTextDecoder *decoder = codec->makeDecoder();
    -
    -    TQString unicodeString;
    -    while( receiving_data ) {
    -        TQByteArray chunk = new_data;
    -        unicodeString += decoder->toUnicode( chunk.data(), chunk.length() );
    -    }
    -    
    - -

    The TQTextDecoder object maintains state between chunks and therefore -works correctly even if a multi-byte character is split between -chunks. -

    -

    Creating your own Codec class -

    -

    Support for new text encodings can be added to TQt by creating -TQTextCodec subclasses. -

    Built-in codecs can be overridden by custom codecs since more -recently created TQTextCodec objects take precedence over earlier -ones. -

    You may find it more convenient to make your codec class available -as a plugin; see the plugin - documentation for more details. -

    The abstract virtual functions describe the encoder to the -system and the coder is used as required in the different -text file formats supported by TQTextStream, and under X11, for the -locale-specific character input and output. -

    To add support for another 8-bit encoding to TQt, make a subclass -of TQTextCodec and implement at least the following methods: -

    -    const char* name() const
    -    
    - -Return the official name for the encoding. -

    -    int mibEnum() const
    -    
    - -Return the MIB enum for the encoding if it is listed in the -IANA character-sets encoding file. -

    If the encoding is multi-byte then it will have "state"; that is, -the interpretation of some bytes will be dependent on some preceding -bytes. For such encodings, you must implement: -

    -    TQTextDecoder* makeDecoder() const
    -    
    - -Return a TQTextDecoder that remembers incomplete multi-byte sequence -prefixes or other required state. -

    If the encoding does not require state, you should implement: -

    -    TQString toUnicode(const char* chars, int len) const
    -    
    - -Converts len characters from chars to Unicode. -

    The base TQTextCodec class has default implementations of the above -two functions, but they are mutually recursive, so you must -re-implement at least one of them, or both for improved efficiency. -

    For conversion from Unicode to 8-bit encodings, it is rarely necessary -to maintain state. However, two functions similar to the two above -are used for encoding: -

    -    TQTextEncoder* makeEncoder() const
    -    
    - -Return a TQTextEncoder. -

    -    TQCString fromUnicode(const TQString& uc, int& lenInOut ) const
    -    
    - -Converts lenInOut characters (of type TQChar) from the start of -the string uc, returning a TQCString result, and also returning -the length of the result in -lenInOut. -

    Again, these are mutually recursive so only one needs to be implemented, -or both if greater efficiency is possible. -

    Finally, you must implement: -

    -    int heuristicContentMatch(const char* chars, int len) const
    -    
    - -Gives a value indicating how likely it is that len characters -from chars are in the encoding. -

    A good model for this function is the -TQWindowsLocalCodec::heuristicContentMatch function found in the TQt -sources. -

    A TQTextCodec subclass might have improved performance if you also -re-implement: -

    -    bool canEncode( TQChar ) const
    -    
    - -Test if a Unicode character can be encoded. -

    -    bool canEncode( const TQString& ) const
    -    
    - -Test if a string of Unicode characters can be encoded. -

    -    int heuristicNameMatch(const char* hint) const
    -    
    - -Test if a possibly non-standard name is referring to the codec. -

    Codecs can also be created as plugins. -

    See also Internationalization with TQt. - -


    Member Function Documentation

    -

    TQTextCodec::TQTextCodec () [protected] -

    Warning: This function is not reentrant.

    - - -

    Constructs a TQTextCodec, and gives it the highest precedence. The -TQTextCodec should always be constructed on the heap (i.e. with new). TQt takes ownership and will delete it when the application -terminates. - -

    TQTextCodec::~TQTextCodec () [virtual] -

    Warning: This function is not reentrant.

    - - -

    Destroys the TQTextCodec. Note that you should not delete codecs -yourself: once created they become TQt's responsibility. - -

    bool TQTextCodec::canEncode ( TQChar ch ) const [virtual] -

    -Returns TRUE if the Unicode character ch can be fully encoded -with this codec; otherwise returns FALSE. The default -implementation tests if the result of toUnicode(fromUnicode(ch)) -is the original ch. Subclasses may be able to improve the -efficiency. - -

    bool TQTextCodec::canEncode ( const TQString & s ) const [virtual] -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    s contains the string being tested for encode-ability. - -

    TQTextCodec * TQTextCodec::codecForCStrings () [static] -

    - -

    Returns the codec used by TQString to convert to and from const -char* and TQCStrings. If this function returns 0 (the default), -TQString assumes Latin-1. -

    See also setCodecForCStrings(). - -

    TQTextCodec * TQTextCodec::codecForContent ( const char * chars, int len ) [static] -

    -Searches all installed TQTextCodec objects, returning the one which -most recognizes the given content. May return 0. -

    Note that this is often a poor choice, since character encodings -often use most of the available character sequences, and so only -by linguistic analysis could a true match be made. -

    chars contains the string to check, and len contains the -number of characters in the string to use. -

    See also heuristicContentMatch(). - -

    Example: qwerty/qwerty.cpp. -

    TQTextCodec * TQTextCodec::codecForIndex ( int i ) [static] -

    -Returns the TQTextCodec i positions from the most recently -inserted codec, or 0 if there is no such TQTextCodec. Thus, -codecForIndex(0) returns the most recently created TQTextCodec. - -

    Example: qwerty/qwerty.cpp. -

    TQTextCodec * TQTextCodec::codecForLocale () [static] -

    Returns a pointer to the codec most suitable for this locale. -

    Example: qwerty/qwerty.cpp. -

    TQTextCodec * TQTextCodec::codecForMib ( int mib ) [static] -

    -Returns the TQTextCodec which matches the MIBenum mib. - -

    TQTextCodec * TQTextCodec::codecForName ( const char * name, int accuracy = 0 ) [static] -

    -Searches all installed TQTextCodec objects and returns the one -which best matches name; the match is case-insensitive. Returns -0 if no codec's heuristicNameMatch() reports a match better than -accuracy, or if name is a null string. -

    See also heuristicNameMatch(). - -

    TQTextCodec * TQTextCodec::codecForTr () [static] -

    - -

    Returns the codec used by TQObject::tr() on its argument. If this -function returns 0 (the default), tr() assumes Latin-1. -

    See also setCodecForTr(). - -

    void TQTextCodec::deleteAllCodecs () [static] -

    -Deletes all the created codecs. -

    Warning: Do not call this function. -

    TQApplication calls this function just before exiting to delete -any TQTextCodec objects that may be lying around. Since various -other classes hold pointers to TQTextCodec objects, it is not safe -to call this function earlier. -

    If you are using the utility classes (like TQString) but not using -TQApplication, calling this function at the very end of your -application may be helpful for chasing down memory leaks by -eliminating any TQTextCodec objects. - -

    TQCString TQTextCodec::fromUnicode ( const TQString & uc, int & lenInOut ) const [virtual] -

    -TQTextCodec subclasses must reimplement either this function or -makeEncoder(). It converts the first lenInOut characters of uc from Unicode to the encoding of the subclass. If lenInOut is -negative or too large, the length of uc is used instead. -

    Converts lenInOut characters (not bytes) from uc, producing -a TQCString. lenInOut will be set to the length of the result (in bytes). -

    The default implementation makes an encoder with makeEncoder() and -converts the input with that. Note that the default makeEncoder() -implementation makes an encoder that simply calls this function, -hence subclasses must reimplement one function or the other to -avoid infinite recursion. - -

    Reimplemented in TQHebrewCodec. -

    TQCString TQTextCodec::fromUnicode ( const TQString & uc ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    uc is the unicode source string. - -

    int TQTextCodec::heuristicContentMatch ( const char * chars, int len ) const [pure virtual] -

    - -

    TQTextCodec subclasses must reimplement this function. It examines -the first len bytes of chars and returns a value indicating -how likely it is that the string is a prefix of text encoded in -the encoding of the subclass. A negative return value indicates -that the text is detectably not in the encoding (e.g. it contains -characters undefined in the encoding). A return value of 0 -indicates that the text should be decoded with this codec rather -than as ASCII, but there is no particular evidence. The value -should range up to len. Thus, most decoders will return -1, 0, -or -len. -

    The characters are not null terminated. -

    See also codecForContent(). - -

    int TQTextCodec::heuristicNameMatch ( const char * hint ) const [virtual] -

    -Returns a value indicating how likely it is that this decoder is -appropriate for decoding some format that has the given name. The -name is compared with the hint. -

    A good match returns a positive number around the length of the -string. A bad match is negative. -

    The default implementation calls simpleHeuristicNameMatch() with -the name of the codec. - -

    TQTextCodec * TQTextCodec::loadCharmap ( TQIODevice * iod ) [static] -

    -Reads a POSIX2 charmap definition from iod. -The parser recognizes the following lines: -

    -  <code_set_name> name
    -  <escape_char> character
    -  % alias alias
    -  CHARMAP
    -  <token> /xhexbyte <Uunicode> ...
    -  <token> /ddecbyte <Uunicode> ...
    -  <token> /octbyte <Uunicode> ...
    -  <token> /any/any... <Uunicode> ...
    -  END CHARMAP
    -
    -

    The resulting TQTextCodec is returned (and also added to the global -list of codecs). The name() of the result is taken from the -code_set_name. -

    Note that a codec constructed in this way uses much more memory -and is slower than a hand-written TQTextCodec subclass, since -tables in code are kept in memory shared by all TQt applications. -

    See also loadCharmapFile(). - -

    Example: qwerty/qwerty.cpp. -

    TQTextCodec * TQTextCodec::loadCharmapFile ( TQString filename ) [static] -

    -A convenience function for loadCharmap() that loads the charmap -definition from the file filename. - -

    const char * TQTextCodec::locale () [static] -

    -Returns a string representing the current language and -sublanguage, e.g. "pt" for Portuguese, or "pt_br" for Portuguese/Brazil. - -

    Example: i18n/main.cpp. -

    TQTextDecoder * TQTextCodec::makeDecoder () const [virtual] -

    -Creates a TQTextDecoder which stores enough state to decode chunks -of char* data to create chunks of Unicode data. The default -implementation creates a stateless decoder, which is only -sufficient for the simplest encodings where each byte corresponds -to exactly one Unicode character. -

    The caller is responsible for deleting the returned object. - -

    TQTextEncoder * TQTextCodec::makeEncoder () const [virtual] -

    -Creates a TQTextEncoder which stores enough state to encode chunks -of Unicode data as char* data. The default implementation creates -a stateless encoder, which is only sufficient for the simplest -encodings where each Unicode character corresponds to exactly one -character. -

    The caller is responsible for deleting the returned object. - -

    int TQTextCodec::mibEnum () const [pure virtual] -

    - -

    Subclasses of TQTextCodec must reimplement this function. It -returns the MIBenum (see the - IANA character-sets encoding file for more information). -It is important that each TQTextCodec subclass returns the correct -unique value for this function. - -

    Reimplemented in TQEucJpCodec. -

    const char * TQTextCodec::mimeName () const [virtual] -

    -Returns the preferred mime name of the encoding as defined in the -IANA character-sets encoding file. - -

    Reimplemented in TQEucJpCodec, TQEucKrCodec, TQJisCodec, TQHebrewCodec, and TQSjisCodec. -

    const char * TQTextCodec::name () const [pure virtual] -

    - -

    TQTextCodec subclasses must reimplement this function. It returns -the name of the encoding supported by the subclass. When choosing -a name for an encoding, consider these points: -

      -
    • On X11, heuristicNameMatch( const char * hint ) -is used to test if a the TQTextCodec -can convert between Unicode and the encoding of a font -with encoding hint, such as "iso8859-1" for Latin-1 fonts, -"koi8-r" for Russian KOI8 fonts. -The default algorithm of heuristicNameMatch() uses name(). -
    • Some applications may use this function to present -encodings to the end user. -
    - -

    Example: qwerty/qwerty.cpp. -

    void TQTextCodec::setCodecForCStrings ( TQTextCodec * c ) [static] -

    Warning: This function is not reentrant.

    - - - -

    Sets the codec used by TQString to convert to and from const char* -and TQCStrings. If c is 0 (the default), TQString assumes Latin-1. -

    Warning: Some codecs do not preserve the characters in the ascii -range (0x00 to 0x7f). For example, the Japanese Shift-JIS -encoding maps the backslash character (0x5a) to the Yen character. -This leads to unexpected results when using the backslash -character to escape characters in strings used in e.g. regular -expressions. Use TQString::fromLatin1() to preserve characters in -the ascii range when needed. -

    See also codecForCStrings() and setCodecForTr(). - -

    void TQTextCodec::setCodecForLocale ( TQTextCodec * c ) [static] -

    -Set the codec to c; this will be returned by codecForLocale(). -This might be needed for some applications that want to use their -own mechanism for setting the locale. -

    See also codecForLocale(). - -

    void TQTextCodec::setCodecForTr ( TQTextCodec * c ) [static] -

    Warning: This function is not reentrant.

    - - - -

    Sets the codec used by TQObject::tr() on its argument to c. If -c is 0 (the default), tr() assumes Latin-1. -

    If the literal quoted text in the program is not in the Latin-1 -encoding, this function can be used to set the appropriate -encoding. For example, software developed by Korean programmers -might use eucKR for all the text in the program, in which case the -main() function might look like this: -

    -    int main(int argc, char** argv)
    -    {
    -        TQApplication app(argc, argv);
    -        ... install any additional codecs ...
    -        TQTextCodec::setCodecForTr( TQTextCodec::codecForName("eucKR") );
    -        ...
    -    }
    -    
    - -

    Note that this is not the way to select the encoding that the user has chosen. For example, to convert an application containing -literal English strings to Korean, all that is needed is for the -English strings to be passed through tr() and for translation -files to be loaded. For details of internationalization, see the -TQt internationalization documentation. -

    See also codecForTr() and setCodecForCStrings(). - -

    int TQTextCodec::simpleHeuristicNameMatch ( const char * name, const char * hint ) [static protected] -

    -A simple utility function for heuristicNameMatch(): it does some -very minor character-skipping so that almost-exact matches score -high. name is the text we're matching and hint is used for -the comparison. - -

    TQString TQTextCodec::toUnicode ( const char * chars, int len ) const [virtual] -

    -TQTextCodec subclasses must reimplement this function or -makeDecoder(). It converts the first len characters of chars -to Unicode. -

    The default implementation makes a decoder with makeDecoder() and -converts the input with that. Note that the default makeDecoder() -implementation makes a decoder that simply calls -this function, hence subclasses must reimplement one function or -the other to avoid infinite recursion. - -

    TQString TQTextCodec::toUnicode ( const TQByteArray & a, int len ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    a contains the source characters; len contains the number of -characters in a to use. - -

    TQString TQTextCodec::toUnicode ( const TQByteArray & a ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    a contains the source characters. - -

    TQString TQTextCodec::toUnicode ( const TQCString & a, int len ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    a contains the source characters; len contains the number of -characters in a to use. - -

    TQString TQTextCodec::toUnicode ( const TQCString & a ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    a contains the source characters. - -

    TQString TQTextCodec::toUnicode ( const char * chars ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    chars contains the source characters. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqtextcodecplugin.html b/doc/html/ntqtextcodecplugin.html deleted file mode 100644 index 4dbb9d31..00000000 --- a/doc/html/ntqtextcodecplugin.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - -TQTextCodecPlugin Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextCodecPlugin Class Reference

    - -

    The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. -More... -

    All the functions in this class are reentrant when TQt is built with thread support.

    -

    #include <ntqtextcodecplugin.h> -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. - - -

    The text codec plugin is a simple plugin interface that makes it -easy to create custom text codecs that can be loaded dynamically -into applications. -

    Writing a text codec plugin is achieved by subclassing this base -class, reimplementing the pure virtual functions names(), -createForName(), mibEnums() and createForMib(), and exporting the -class with the TQ_EXPORT_PLUGIN macro. See the TQt Plugins documentation for details. -

    See the IANA - character-sets encoding file for more information on mime -names and mib enums. -

    See also Plugins. - -


    Member Function Documentation

    -

    TQTextCodecPlugin::TQTextCodecPlugin () -

    -Constructs a text codec plugin. This is invoked automatically by -the TQ_EXPORT_PLUGIN macro. - -

    TQTextCodecPlugin::~TQTextCodecPlugin () -

    -Destroys the text codec plugin. -

    You never have to call this explicitly. TQt destroys a plugin -automatically when it is no longer used. - -

    TQTextCodec * TQTextCodecPlugin::createForMib ( int mib ) [pure virtual] -

    - -

    Creates a TQTextCodec object for the mib enum mib. -

    (See the - IANA character-sets encoding file for more information) -

    See also mibEnums(). - -

    TQTextCodec * TQTextCodecPlugin::createForName ( const TQString & name ) [pure virtual] -

    - -

    Creates a TQTextCodec object for the codec called name. -

    See also names(). - -

    TQValueList<int> TQTextCodecPlugin::mibEnums () const [pure virtual] -

    - -

    Returns the list of mib enums supported by this plugin. -

    See also createForMib(). - -

    TQStringList TQTextCodecPlugin::names () const [pure virtual] -

    - -

    Returns the list of mime names supported by this plugin. -

    See also createForName(). - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqtextedit.html b/doc/html/ntqtextedit.html deleted file mode 100644 index 01610e7a..00000000 --- a/doc/html/ntqtextedit.html +++ /dev/null @@ -1,1626 +0,0 @@ - - - - - -TQTextEdit Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextEdit Class Reference

    - -

    The TQTextEdit widget provides a powerful single-page rich text editor. -More... -

    #include <ntqtextedit.h> -

    Inherits TQScrollView. -

    Inherited by TQMultiLineEdit, TQTextBrowser, and TQTextView. -

    List of all member functions. -

    Public Members

    - -

    Public Slots

    - -

    Signals

    - -

    Properties

    -
      -
    • AutoFormatting autoFormatting - the enabled set of auto formatting features
    • -
    • TQString documentTitle - the title of the document parsed from the text  (read only)
    • -
    • bool hasSelectedText - whether some text is selected in selection 0  (read only)
    • -
    • int length - the number of characters in the text  (read only)
    • -
    • bool linkUnderline - whether hypertext links will be underlined
    • -
    • bool modified - whether the document has been modified by the user
    • -
    • bool overwriteMode - the text edit's overwrite mode
    • -
    • TQBrush paper - the background (paper) brush
    • -
    • bool readOnly - whether the text edit is read-only
    • -
    • TQString selectedText - the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0)  (read only)
    • -
    • bool tabChangesFocus - whether TAB changes focus or is accepted as input
    • -
    • int tabStopWidth - the tab stop width in pixels
    • -
    • TQString text - the text edit's text
    • -
    • TextFormat textFormat - the text format: rich text, plain text, log text or auto text
    • -
    • int undoDepth - the depth of the undo history
    • -
    • bool undoRedoEnabled - whether undo/redo is enabled
    • -
    • WordWrap wordWrap - the word wrap mode
    • -
    • int wrapColumnOrWidth - the position (in pixels or columns depending on the wrap mode) where text will be wrapped
    • -
    • WrapPolicy wrapPolicy - the word wrap policy, at whitespace or anywhere
    • -
    -

    Protected Members

    - -

    Detailed Description

    - - -The TQTextEdit widget provides a powerful single-page rich text editor. -

    - - -

    -

    - - -

    Introduction and Concepts -

    -

    TQTextEdit is an advanced WYSIWYG viewer/editor supporting rich -text formatting using HTML-style tags. It is optimized to handle -large documents and to respond quickly to user input. -

    TQTextEdit has four modes of operation: -

    -
    Mode Command Notes -
    Plain Text Editor setTextFormat(PlainText) -Set text with setText(); text() returns plain text. Text -attributes (e.g. colors) can be set, but plain text is always -returned. -
    Rich Text Editor setTextFormat(RichText) -Set text with setText(); text() returns rich text. Rich -text editing is fairly limited. You can't set margins or -insert images for example (although you can read and -correctly display files that have margins set and that -include images). This mode is mostly useful for editing small -amounts of rich text. 1. -
    Text Viewer setReadOnly(TRUE) -Set text with setText() or append() (which has no undo -history so is faster and uses less memory); text() returns -plain or rich text depending on the textFormat(). This mode -can correctly display a large subset of HTML tags. -
    Log Viewer setTextFormat(LogText) -Append text using append(). The widget is set to be read -only and rich text support is disabled although a few HTML -tags (for color, bold, italic and underline) may be used. -(See LogText mode for details.) -
    -

    1.A more complete API that supports setting -margins, images, etc., is planned for a later TQt release. -

    TQTextEdit can be used as a syntax highlighting editor when used in -conjunction with TQSyntaxHighlighter. -

    We recommend that you always call setTextFormat() to set the mode -you want to use. If you use AutoText then setText() and -append() will try to determine whether the text they are given is -plain text or rich text. If you use RichText then setText() and -append() will assume that the text they are given is rich text. -insert() simply inserts the text it is given. -

    TQTextEdit works on paragraphs and characters. A paragraph is a -formatted string which is word-wrapped to fit into the width of -the widget. By default when reading plain text, one newline -signify a paragraph. A document consists of zero or more -paragraphs, indexed from 0. Characters are indexed on a -per-paragraph basis, also indexed from 0. The words in the -paragraph are aligned in accordance with the paragraph's -alignment(). Paragraphs are separated by hard line breaks. Each -character within a paragraph has its own attributes, for example, -font and color. -

    The text edit documentation uses the following concepts: -

      -
    • current format -- -this is the format at the current cursor position, and it -is the format of the selected text if any. -
    • current paragraph -- the paragraph which contains the -cursor. -
    -

    TQTextEdit can display images (using TQMimeSourceFactory), lists and -tables. If the text is too large to view within the text edit's -viewport, scrollbars will appear. The text edit can load both -plain text and HTML files (a subset of HTML 3.2 and 4). The -rendering style and the set of valid tags are defined by a -styleSheet(). Custom tags can be created and placed in a custom -style sheet. Change the style sheet with setStyleSheet(); see -TQStyleSheet for details. The images identified by image tags are -displayed if they can be interpreted using the text edit's -TQMimeSourceFactory; see setMimeSourceFactory(). -

    If you want a text browser with more navigation use TQTextBrowser. -If you just need to display a small piece of rich text use TQLabel -or TQSimpleRichText. -

    If you create a new TQTextEdit, and want to allow the user to edit -rich text, call setTextFormat(TQt::RichText) to ensure that the -text is treated as rich text. (Rich text uses HTML tags to set -text formatting attributes. See TQStyleSheet for information on the -HTML tags that are supported.). If you don't call setTextFormat() -explicitly the text edit will guess from the text itself whether -it is rich text or plain text. This means that if the text looks -like HTML or XML it will probably be interpreted as rich text, so -you should call setTextFormat(TQt::PlainText) to preserve such -text. -

    Note that we do not intend to add a full-featured web browser -widget to TQt (because that would easily double TQt's size and only -a few applications would benefit from it). The rich -text support in TQt is designed to provide a fast, portable and -efficient way to add reasonable online help facilities to -applications, and to provide a basis for rich text editors. -

    Using TQTextEdit as a Display Widget -

    -

    TQTextEdit can display a large HTML subset, including tables and -images. -

    The text is set or replaced using setText() which deletes any -existing text and replaces it with the text passed in the -setText() call. If you call setText() with legacy HTML (with -setTextFormat(RichText) in force), and then call text(), the text -that is returned may have different markup, but will render the -same. Text can be inserted with insert(), paste(), pasteSubType() -and append(). Text that is appended does not go into the undo -history; this makes append() faster and consumes less memory. Text -can also be cut(). The entire text is deleted with clear() and the -selected text is deleted with removeSelectedText(). Selected -(marked) text can also be deleted with del() (which will delete -the character to the right of the cursor if no text is selected). -

    Loading and saving text is achieved using setText() and text(), -for example: -

    -    TQFile file( fileName ); // Read the text from a file
    -    if ( file.open( IO_ReadOnly ) ) {
    -        TQTextStream stream( &file );
    -        textEdit->setText( stream.read() );
    -    }
    -
    -    TQFile file( fileName ); // Write the text to a file
    -    if ( file.open( IO_WriteOnly ) ) {
    -        TQTextStream stream( &file );
    -        stream << textEdit->text();
    -        textEdit->setModified( FALSE );
    -    }
    -    
    - -

    By default the text edit wraps words at whitespace to fit within -the text edit widget. The setWordWrap() function is used to -specify the kind of word wrap you want, or NoWrap if you don't -want any wrapping. Call setWordWrap() to set a fixed pixel width -FixedPixelWidth, or character column (e.g. 80 column) FixedColumnWidth with the pixels or columns specified with -setWrapColumnOrWidth(). If you use word wrap to the widget's width -WidgetWidth, you can specify whether to break on whitespace or -anywhere with setWrapPolicy(). -

    The background color is set differently than other widgets, using -setPaper(). You specify a brush style which could be a plain color -or a complex pixmap. -

    Hypertext links are automatically underlined; this can be changed -with setLinkUnderline(). The tab stop width is set with -setTabStopWidth(). -

    The zoomIn() and zoomOut() functions can be used to resize the -text by increasing (decreasing for zoomOut()) the point size used. -Images are not affected by the zoom functions. -

    The lines() function returns the number of lines in the text and -paragraphs() returns the number of paragraphs. The number of lines -within a particular paragraph is returned by linesOfParagraph(). -The length of the entire text in characters is returned by -length(). -

    You can scroll to an anchor in the text, e.g. -<a name="anchor"> with scrollToAnchor(). The find() function -can be used to find and select a given string within the text. -

    A read-only TQTextEdit provides the same functionality as the -(obsolete) TQTextView. (TQTextView is still supplied for -compatibility with old code.) -

    Read-only key bindings -

    -

    When TQTextEdit is used read-only the key-bindings are limited to -navigation, and text may only be selected with the mouse: -

    -
    Keypresses Action -
    UpArrow Move one line up -
    DownArrow Move one line down -
    LeftArrow Move one character left -
    RightArrow Move one character right -
    PageUp Move one (viewport) page up -
    PageDown Move one (viewport) page down -
    Home Move to the beginning of the text -
    End Move to the end of the text -
    Shift+Wheel -Scroll the page horizontally (the Wheel is the mouse wheel) -
    Ctrl+Wheel Zoom the text -
    -

    The text edit may be able to provide some meta-information. For -example, the documentTitle() function will return the text from -within HTML <title> tags. -

    The text displayed in a text edit has a context. The context is -a path which the text edit's TQMimeSourceFactory uses to resolve -the locations of files and images. It is passed to the -mimeSourceFactory() when quering data. (See TQTextEdit() and -context().) -

    -

    Using TQTextEdit in LogText Mode -

    -

    Setting the text format to LogText puts the widget in a special -mode which is optimized for very large texts. Editing, word wrap, -and rich text support are disabled in this mode (the widget is -explicitly made read-only). This allows the text to be stored in a -different, more memory efficient manner. However, a certain degree -of text formatting is supported through the use of formatting tags. -A tag is delimited by < and >. The characters <, > -and & are escaped by using &lt;, &gt; and &amp;. -A tag pair consists of a left and a right tag (or open/close tags). -Left-tags mark the starting point for formatting, while right-tags -mark the ending point. A right-tag always start with a / before -the tag keyword. For example <b> and </b> are a tag pair. -Tags can be nested, but they have to be closed in the same order as -they are opened. For example, <b><u></u></b> is valid, while <b><u></b></u> will output an error message. -

    By using tags it is possible to change the color, bold, italic and -underline settings for a piece of text. A color can be specified -by using the HTML font tag <font color=colorname>. The color -name can be one of the color names from the X11 color database, or -a RGB hex value (e.g #00ff00). Example of valid color tags: -<font color=red>, <font color="light blue">, <font color="#223344">. Bold, italic and underline settings can be -specified by the tags <b>, <i> and <u>. Note that a -tag does not necessarily have to be closed. A valid example: -

    -    This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>.
    -    <font color=green><font color=yellow>Yellow,</font> and <u>green</u>.
    -    
    - -

    Stylesheets can also be used in LogText mode. To create and use a -custom tag, you could do the following: -

    -    TQTextEdit * log = new TQTextEdit( this );
    -    log->setTextFormat( TQt::LogText );
    -    TQStyleSheetItem * item = new TQStyleSheetItem( log->styleSheet(), "mytag" );
    -    item->setColor( "red" );
    -    item->setFontWeight( TQFont::Bold );
    -    item->setFontUnderline( TRUE );
    -    log->append( "This is a <mytag>custom tag</mytag>!" );
    -    
    - -Note that only the color, bold, underline and italic attributes of -a TQStyleSheetItem is used in LogText mode. -

    Note that you can use setMaxLogLines() to limit the number of -lines the widget can hold in LogText mode. -

    There are a few things that you need to be aware of when the -widget is in this mode: -

      -
    • Functions that deal with rich text formatting and cursor -movement will not work or return anything valid. -
    • Lines are equivalent to paragraphs. -
    -

    Using TQTextEdit as an Editor -

    -

    All the information about using TQTextEdit as a display widget also -applies here. -

    The current format's attributes are set with setItalic(), -setBold(), setUnderline(), setFamily() (font family), -setPointSize(), setColor() and setCurrentFont(). The current -paragraph's alignment is set with setAlignment(). -

    Use setSelection() to select text. The setSelectionAttributes() -function is used to indicate how selected text should be -displayed. Use hasSelectedText() to find out if any text is -selected. The currently selected text's position is available -using getSelection() and the selected text itself is returned by -selectedText(). The selection can be copied to the clipboard with -copy(), or cut to the clipboard with cut(). It can be deleted with -removeSelectedText(). The entire text can be selected (or -unselected) using selectAll(). TQTextEdit supports multiple -selections. Most of the selection functions operate on the default -selection, selection 0. If the user presses a non-selecting key, -e.g. a cursor key without also holding down Shift, all selections -are cleared. -

    Set and get the position of the cursor with setCursorPosition() -and getCursorPosition() respectively. When the cursor is moved, -the signals currentFontChanged(), currentColorChanged() and -currentAlignmentChanged() are emitted to reflect the font, color -and alignment at the new cursor position. -

    If the text changes, the textChanged() signal is emitted, and if -the user inserts a new line by pressing Return or Enter, -returnPressed() is emitted. The isModified() function will return -TRUE if the text has been modified. -

    TQTextEdit provides command-based undo and redo. To set the depth -of the command history use setUndoDepth() which defaults to 100 -steps. To undo or redo the last operation call undo() or redo(). -The signals undoAvailable() and redoAvailable() indicate whether -the undo and redo operations can be executed. -

    The indent() function is used to reindent a paragraph. It is -useful for code editors, for example in TQt Designer's code editor Ctrl+I invokes the indent() -function. -

    Editing key bindings -

    -

    The list of key-bindings which are implemented for editing: -

    -
    Keypresses Action -
    Backspace Delete the character to the left of the cursor -
    Delete Delete the character to the right of the cursor -
    Ctrl+A Move the cursor to the beginning of the line -
    Ctrl+B Move the cursor one character left -
    Ctrl+C Copy the marked text to the clipboard (also -Ctrl+Insert under Windows) -
    Ctrl+D Delete the character to the right of the cursor -
    Ctrl+E Move the cursor to the end of the line -
    Ctrl+F Move the cursor one character right -
    Ctrl+H Delete the character to the left of the cursor -
    Ctrl+K Delete to end of line -
    Ctrl+N Move the cursor one line down -
    Ctrl+P Move the cursor one line up -
    Ctrl+V Paste the clipboard text into line edit -(also Shift+Insert under Windows) -
    Ctrl+X Cut the marked text, copy to clipboard -(also Shift+Delete under Windows) -
    Ctrl+Z Undo the last operation -
    Ctrl+Y Redo the last operation -
    LeftArrow Move the cursor one character left -
    Ctrl+LeftArrow Move the cursor one word left -
    RightArrow Move the cursor one character right -
    Ctrl+RightArrow Move the cursor one word right -
    UpArrow Move the cursor one line up -
    Ctrl+UpArrow Move the cursor one word up -
    DownArrow Move the cursor one line down -
    Ctrl+Down Arrow Move the cursor one word down -
    PageUp Move the cursor one page up -
    PageDown Move the cursor one page down -
    Home Move the cursor to the beginning of the line -
    Ctrl+Home Move the cursor to the beginning of the text -
    End Move the cursor to the end of the line -
    Ctrl+End Move the cursor to the end of the text -
    Shift+Wheel Scroll the page horizontally -(the Wheel is the mouse wheel) -
    Ctrl+Wheel Zoom the text -
    -

    To select (mark) text hold down the Shift key whilst pressing one -of the movement keystrokes, for example, Shift+Right Arrow -will select the character to the right, and Shift+Ctrl+Right Arrow will select the word to the right, etc. -

    By default the text edit widget operates in insert mode so all -text that the user enters is inserted into the text edit and any -text to the right of the cursor is moved out of the way. The mode -can be changed to overwrite, where new text overwrites any text to -the right of the cursor, using setOverwriteMode(). -

    See also Basic Widgets and Text Related Classes. - -


    Member Type Documentation

    -

    TQTextEdit::AutoFormatting

    - -
      -
    • TQTextEdit::AutoNone - Do not perform any automatic formatting -
    • TQTextEdit::AutoBulletList - Only automatically format bulletted lists -
    • TQTextEdit::AutoAll - Apply all available autoformatting -
    -

    TQTextEdit::CursorAction

    - -

    This enum is used by moveCursor() to specify in which direction -the cursor should be moved: -

      -
    • TQTextEdit::MoveBackward - Moves the cursor one character backward -
    • TQTextEdit::MoveWordBackward - Moves the cursor one word backward -
    • TQTextEdit::MoveForward - Moves the cursor one character forward -
    • TQTextEdit::MoveWordForward - Moves the cursor one word forward -
    • TQTextEdit::MoveUp - Moves the cursor up one line -
    • TQTextEdit::MoveDown - Moves the cursor down one line -
    • TQTextEdit::MoveLineStart - Moves the cursor to the beginning of the line -
    • TQTextEdit::MoveLineEnd - Moves the cursor to the end of the line -
    • TQTextEdit::MoveHome - Moves the cursor to the beginning of the document -
    • TQTextEdit::MoveEnd - Moves the cursor to the end of the document -
    • TQTextEdit::MovePgUp - Moves the cursor one viewport page up -
    • TQTextEdit::MovePgDown - Moves the cursor one viewport page down -
    -

    TQTextEdit::KeyboardAction

    - -

    This enum is used by doKeyboardAction() to specify which action -should be executed: -

      -
    • TQTextEdit::ActionBackspace - Delete the character to the left of the -cursor. -
    • TQTextEdit::ActionDelete - Delete the character to the right of the -cursor. -
    • TQTextEdit::ActionReturn - Split the paragraph at the cursor position. -
    • TQTextEdit::ActionKill - If the cursor is not at the end of the -paragraph, delete the text from the cursor position until the end -of the paragraph. If the cursor is at the end of the paragraph, -delete the hard line break at the end of the paragraph: this will -cause this paragraph to be joined with the following paragraph. -
    • TQTextEdit::ActionWordBackspace - Delete the word to the left of the -cursor position. -
    • TQTextEdit::ActionWordDelete - Delete the word to the right of the -cursor position -

    -

    TQTextEdit::VerticalAlignment

    - -

    This enum is used to set the vertical alignment of the text. -

      -
    • TQTextEdit::AlignNormal - Normal alignment -
    • TQTextEdit::AlignSuperScript - Superscript -
    • TQTextEdit::AlignSubScript - Subscript -
    -

    TQTextEdit::WordWrap

    - -

    This enum defines the TQTextEdit's word wrap modes. -

      -
    • TQTextEdit::NoWrap - Do not wrap the text. -
    • TQTextEdit::WidgetWidth - Wrap the text at the current width of the -widget (this is the default). Wrapping is at whitespace by -default; this can be changed with setWrapPolicy(). -
    • TQTextEdit::FixedPixelWidth - Wrap the text at a fixed number of pixels -from the widget's left side. The number of pixels is set with -wrapColumnOrWidth(). -
    • TQTextEdit::FixedColumnWidth - Wrap the text at a fixed number of -character columns from the widget's left side. The number of -characters is set with wrapColumnOrWidth(). This is useful if you -need formatted text that can also be displayed gracefully on -devices with monospaced fonts, for example a standard VT100 -terminal, where you might set wrapColumnOrWidth() to 80. -

    See also wordWrap and wordWrap. - -

    TQTextEdit::WrapPolicy

    - -

    This enum defines where text can be wrapped in word wrap mode. -

      -
    • TQTextEdit::AtWhiteSpace - Don't use this deprecated value (it is a -synonym for AtWordBoundary which you should use instead). -
    • TQTextEdit::Anywhere - Break anywhere, including within words. -
    • TQTextEdit::AtWordBoundary - Break lines at word boundaries, e.g. spaces or -newlines -
    • TQTextEdit::AtWordOrDocumentBoundary - Break lines at whitespace, e.g. -spaces or newlines if possible. Break it anywhere otherwise. -

    See also wrapPolicy. - -


    Member Function Documentation

    -

    TQTextEdit::TQTextEdit ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 ) -

    -Constructs a TQTextEdit called name, with parent parent. The -text edit will display the text text using context context. -

    The context is a path which the text edit's TQMimeSourceFactory -uses to resolve the locations of files and images. It is passed to -the mimeSourceFactory() when quering data. -

    For example if the text contains an image tag, -<img src="image.png">, and the context is "path/to/look/in", the -TQMimeSourceFactory will try to load the image from -"path/to/look/in/image.png". If the tag was -<img src="/image.png">, the context will not be used (because -TQMimeSourceFactory recognizes that we have used an absolute path) -and will try to load "/image.png". The context is applied in exactly -the same way to hrefs, for example, -<a href="target.html">Target</a>, would resolve to -"path/to/look/in/target.html". - -

    TQTextEdit::TQTextEdit ( TQWidget * parent = 0, const char * name = 0 ) -

    -Constructs an empty TQTextEdit called name, with parent parent. - -

    int TQTextEdit::alignment () const -

    -Returns the alignment of the current paragraph. -

    See also setAlignment(). - -

    TQString TQTextEdit::anchorAt ( const TQPoint & pos, AnchorAttribute attr ) -

    -If there is an anchor at position pos (in contents -coordinates), the text for attribute attr is returned, -otherwise TQString::null is returned. - -

    TQString TQTextEdit::anchorAt ( const TQPoint & pos ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    If there is an anchor at position pos (in contents -coordinates), its href is returned, otherwise TQString::null is -returned. - -

    void TQTextEdit::append ( const TQString & text ) [virtual slot] -

    -Appends a new paragraph with text to the end of the text edit. Note that -the undo/redo history is cleared by this function, and no undo -history is kept for appends which makes them faster than -insert()s. If you want to append text which is added to the -undo/redo history as well, use insertParagraph(). - -

    Examples: network/clientserver/client/client.cpp, network/clientserver/server/server.cpp, network/httpd/httpd.cpp, and process/process.cpp. -

    uint TQTextEdit::autoFormatting () const -

    Returns the enabled set of auto formatting features. -See the "autoFormatting" property for details. -

    bool TQTextEdit::bold () const -

    -Returns TRUE if the current format is bold; otherwise returns FALSE. -

    See also setBold(). - -

    int TQTextEdit::charAt ( const TQPoint & pos, int * para ) const -

    -Returns the index of the character (relative to its paragraph) at -position pos (in contents coordinates). If para is not 0, -*para is set to the character's paragraph. - -

    void TQTextEdit::clear () [virtual slot] -

    -Deletes all the text in the text edit. -

    See also cut(), removeSelectedText(), and text. - -

    void TQTextEdit::clearParagraphBackground ( int para ) [virtual slot] -

    -Clears the background color of the paragraph para, so that the -default color is used again. - -

    void TQTextEdit::clicked ( int para, int pos ) [signal] -

    - -

    This signal is emitted when the mouse is clicked on the paragraph -para at character position pos. -

    See also doubleClicked(). - -

    TQColor TQTextEdit::color () const -

    -Returns the color of the current format. -

    See also setColor() and paper. - -

    TQString TQTextEdit::context () const -

    -Returns the context of the text edit. The context is a path which -the text edit's TQMimeSourceFactory uses to resolve the locations -of files and images. -

    See also text. - -

    Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp. -

    void TQTextEdit::copy () [virtual slot] -

    -Copies any selected text (from selection 0) to the clipboard. -

    See also hasSelectedText and copyAvailable(). - -

    void TQTextEdit::copyAvailable ( bool yes ) [signal] -

    - -

    This signal is emitted when text is selected or de-selected in the -text edit. -

    When text is selected this signal will be emitted with yes set -to TRUE. If no text has been selected or if the selected text is -de-selected this signal is emitted with yes set to FALSE. -

    If yes is TRUE then copy() can be used to copy the selection to -the clipboard. If yes is FALSE then copy() does nothing. -

    See also selectionChanged(). - -

    TQPopupMenu * TQTextEdit::createPopupMenu ( const TQPoint & pos ) [virtual protected] -

    -This function is called to create a right mouse button popup menu -at the document position pos. If you want to create a custom -popup menu, reimplement this function and return the created popup -menu. Ownership of the popup menu is transferred to the caller. -

    Warning: The TQPopupMenu ID values 0-7 are reserved, and they map to the -standard operations. When inserting items into your custom popup menu, be -sure to specify ID values larger than 7. - -

    TQPopupMenu * TQTextEdit::createPopupMenu () [virtual protected] -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    This function is called to create a right mouse button popup menu. -If you want to create a custom popup menu, reimplement this function -and return the created popup menu. Ownership of the popup menu is -transferred to the caller. -

    This function is only called if createPopupMenu( const TQPoint & ) -returns 0. - -

    void TQTextEdit::currentAlignmentChanged ( int a ) [signal] -

    - -

    This signal is emitted if the alignment of the current paragraph -has changed. -

    The new alignment is a. -

    See also setAlignment(). - -

    void TQTextEdit::currentColorChanged ( const TQColor & c ) [signal] -

    - -

    This signal is emitted if the color of the current format has -changed. -

    The new color is c. -

    See also setColor(). - -

    TQFont TQTextEdit::currentFont () const -

    -Returns the font of the current format. -

    See also setCurrentFont(), setFamily(), and setPointSize(). - -

    void TQTextEdit::currentFontChanged ( const TQFont & f ) [signal] -

    - -

    This signal is emitted if the font of the current format has -changed. -

    The new font is f. -

    See also setCurrentFont(). - -

    void TQTextEdit::currentVerticalAlignmentChanged ( VerticalAlignment a ) [signal] -

    - -

    This signal is emitted if the vertical alignment of the current -format has changed. -

    The new vertical alignment is a. -

    See also setVerticalAlignment(). - -

    void TQTextEdit::cursorPositionChanged ( int para, int pos ) [signal] -

    - -

    This signal is emitted if the position of the cursor has changed. -para contains the paragraph index and pos contains the -character position within the paragraph. -

    See also setCursorPosition(). - -

    void TQTextEdit::cut () [virtual slot] -

    -Copies the selected text (from selection 0) to the clipboard and -deletes it from the text edit. -

    If there is no selected text (in selection 0) nothing happens. -

    See also TQTextEdit::copy(), paste(), and pasteSubType(). - -

    void TQTextEdit::del () [virtual slot] -

    -If there is some selected text (in selection 0) it is deleted. If -there is no selected text (in selection 0) the character to the -right of the text cursor is deleted. -

    See also removeSelectedText() and cut(). - -

    void TQTextEdit::doKeyboardAction ( KeyboardAction action ) [virtual slot] -

    -Executes keyboard action action. This is normally called by a -key event handler. - -

    TQString TQTextEdit::documentTitle () const -

    Returns the title of the document parsed from the text. -See the "documentTitle" property for details. -

    void TQTextEdit::doubleClicked ( int para, int pos ) [signal] -

    -

    This signal is emitted when the mouse is double-clicked on the -paragraph para at character position pos. -

    See also clicked(). - -

    void TQTextEdit::ensureCursorVisible () [virtual slot] -

    -Ensures that the cursor is visible by scrolling the text edit if -necessary. -

    See also setCursorPosition(). - -

    TQString TQTextEdit::family () const -

    -Returns the font family of the current format. -

    See also setFamily(), setCurrentFont(), and setPointSize(). - -

    bool TQTextEdit::find ( const TQString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 ) [virtual] -

    -Finds the next occurrence of the string, expr. Returns TRUE if -expr was found; otherwise returns FALSE. -

    If para and index are both 0 the search begins from the -current cursor position. If para and index are both not 0, -the search begins from the *index character position in the -*para paragraph. -

    If cs is TRUE the search is case sensitive, otherwise it is -case insensitive. If wo is TRUE the search looks for whole word -matches only; otherwise it searches for any matching text. If forward is TRUE (the default) the search works forward from the -starting position to the end of the text, otherwise it works -backwards to the beginning of the text. -

    If expr is found the function returns TRUE. If index and para are not 0, the number of the paragraph in which the first -character of the match was found is put into *para, and the -index position of that character within the paragraph is put into -*index. -

    If expr is not found the function returns FALSE. If index -and para are not 0 and expr is not found, *index -and *para are undefined. -

    Please note that this function will make the next occurrence of -the string (if found) the current selection, and will thus -modify the cursor position. -

    Using the para and index parameters will not work correctly -in case the document contains tables. - -

    bool TQTextEdit::focusNextPrevChild ( bool n ) [virtual protected] -

    -Reimplemented to allow tabbing through links. If n is TRUE the -tab moves the focus to the next child; if n is FALSE the tab -moves the focus to the previous child. Returns TRUE if the focus -was moved; otherwise returns FALSE. - -

    TQFont TQTextEdit::font () const -

    -This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    Returns TQScrollView::font() -

    Warning: In previous versions this function returned the font of -the current format. This lead to confusion. Please use -currentFont() instead. - -

    Example: qwerty/qwerty.cpp. -

    void TQTextEdit::getCursorPosition ( int * para, int * index ) const -

    -This function sets the *para and *index parameters to the -current cursor position. para and index must not be 0. -

    See also setCursorPosition(). - -

    void TQTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const -

    -If there is a selection, *paraFrom is set to the number of the -paragraph in which the selection begins and *paraTo is set to -the number of the paragraph in which the selection ends. (They -could be the same.) *indexFrom is set to the index at which the -selection begins within *paraFrom, and *indexTo is set to -the index at which the selection ends within *paraTo. -

    If there is no selection, *paraFrom, *indexFrom, *paraTo -and *indexTo are all set to -1. -

    If paraFrom, indexFrom, paraTo or indexTo is 0 this -function does nothing. -

    The selNum is the number of the selection (multiple selections -are supported). It defaults to 0 (the default selection). -

    See also setSelection() and selectedText. - -

    bool TQTextEdit::hasSelectedText () const -

    Returns TRUE if some text is selected in selection 0; otherwise returns FALSE. -See the "hasSelectedText" property for details. -

    int TQTextEdit::heightForWidth ( int w ) const [virtual] -

    -Returns how many pixels high the text edit needs to be to display -all the text if the text edit is w pixels wide. - -

    Reimplemented from TQWidget. -

    void TQTextEdit::insert ( const TQString & text, uint insertionFlags = CheckNewLines | RemoveSelected ) [slot] -

    -Inserts text at the current cursor position. -

    The insertionFlags define how the text is inserted. If RedoIndentation is set, the paragraph is re-indented. If CheckNewLines is set, newline characters in text result in hard -line breaks (i.e. new paragraphs). If checkNewLine is not set, -the behaviour of the editor is undefined if the text contains -newlines. (It is not possible to change TQTextEdit's newline handling -behavior, but you can use TQString::replace() to preprocess text -before inserting it.) If RemoveSelected is set, any selected -text (in selection 0) is removed before the text is inserted. -

    The default flags are CheckNewLines | RemoveSelected. -

    If the widget is in LogText mode this function will do nothing. -

    See also paste() and pasteSubType(). - -

    void TQTextEdit::insert ( const TQString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE ) [virtual slot] -

    -This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    -

    void TQTextEdit::insertAt ( const TQString & text, int para, int index ) [virtual slot] -

    -Inserts text in the paragraph para at position index. - -

    void TQTextEdit::insertParagraph ( const TQString & text, int para ) [virtual slot] -

    -Inserts text as a new paragraph at position para. If para -is -1, the text is appended. Use append() if the append operation -is performance critical. - -

    bool TQTextEdit::isModified () const -

    Returns TRUE if the document has been modified by the user; otherwise returns FALSE. -See the "modified" property for details. -

    bool TQTextEdit::isOverwriteMode () const -

    Returns the text edit's overwrite mode. -See the "overwriteMode" property for details. -

    bool TQTextEdit::isReadOnly () const -

    Returns TRUE if the text edit is read-only; otherwise returns FALSE. -See the "readOnly" property for details. -

    bool TQTextEdit::isRedoAvailable () const -

    -Returns TRUE if redo is available; otherwise returns FALSE. - -

    bool TQTextEdit::isUndoAvailable () const -

    -Returns TRUE if undo is available; otherwise returns FALSE. - -

    bool TQTextEdit::isUndoRedoEnabled () const -

    Returns TRUE if undo/redo is enabled; otherwise returns FALSE. -See the "undoRedoEnabled" property for details. -

    bool TQTextEdit::italic () const -

    -Returns TRUE if the current format is italic; otherwise returns FALSE. -

    See also setItalic(). - -

    void TQTextEdit::keyPressEvent ( TQKeyEvent * e ) [virtual protected] -

    -Processes the key event, e. By default key events are used to -provide keyboard navigation and text editing. - -

    Reimplemented from TQWidget. -

    Reimplemented in TQTextBrowser. -

    int TQTextEdit::length () const -

    Returns the number of characters in the text. -See the "length" property for details. -

    int TQTextEdit::lineOfChar ( int para, int index ) -

    -Returns the line number of the line in paragraph para in which -the character at position index appears. The index position is -relative to the beginning of the paragraph. If there is no such -paragraph or no such character at the index position (e.g. the -index is out of range) -1 is returned. - -

    int TQTextEdit::lines () const -

    -Returns the number of lines in the text edit; this could be 0. -

    Warning: This function may be slow. Lines change all the time -during word wrapping, so this function has to iterate over all the -paragraphs and get the number of lines from each one individually. - -

    int TQTextEdit::linesOfParagraph ( int para ) const -

    -Returns the number of lines in paragraph para, or -1 if there -is no paragraph with index para. - -

    bool TQTextEdit::linkUnderline () const -

    Returns TRUE if hypertext links will be underlined; otherwise returns FALSE. -See the "linkUnderline" property for details. -

    int TQTextEdit::maxLogLines () [slot] -

    -Returns the maximum number of lines TQTextEdit can hold in LogText mode. By default the number of lines is unlimited, which -is signified by a value of -1. - -

    TQMimeSourceFactory * TQTextEdit::mimeSourceFactory () const -

    -Returns the TQMimeSourceFactory which is being used by this text -edit. -

    See also setMimeSourceFactory(). - -

    Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp. -

    void TQTextEdit::modificationChanged ( bool m ) [signal] -

    - -

    This signal is emitted when the modification status of the -document has changed. If m is TRUE, the document was modified, -otherwise the modification state has been reset to unmodified. -

    See also modified. - -

    void TQTextEdit::moveCursor ( CursorAction action, bool select ) [virtual slot] -

    -Moves the text cursor according to action. This is normally -used by some key event handler. select specifies whether the -text between the current cursor position and the new position -should be selected. - -

    TQBrush TQTextEdit::paper () const -

    Returns the background (paper) brush. -See the "paper" property for details. -

    int TQTextEdit::paragraphAt ( const TQPoint & pos ) const -

    -Returns the paragraph which is at position pos (in contents -coordinates). - -

    TQColor TQTextEdit::paragraphBackgroundColor ( int para ) const -

    -Returns the background color of the paragraph para or an -invalid color if para is out of range or the paragraph has no -background set - -

    int TQTextEdit::paragraphLength ( int para ) const -

    -Returns the length of the paragraph para (i.e. the number of -characters), or -1 if there is no paragraph with index para. -

    This function ignores newlines. - -

    TQRect TQTextEdit::paragraphRect ( int para ) const -

    -Returns the rectangle of the paragraph para in contents -coordinates, or an invalid rectangle if para is out of range. - -

    int TQTextEdit::paragraphs () const -

    -Returns the number of paragraphs in the text; an empty textedit is always -considered to have one paragraph, so 1 is returned in this case. - -

    void TQTextEdit::paste () [virtual slot] -

    -Pastes the text from the clipboard into the text edit at the -current cursor position. Only plain text is pasted. -

    If there is no text in the clipboard nothing happens. -

    See also pasteSubType(), cut(), and TQTextEdit::copy(). - -

    void TQTextEdit::pasteSubType ( const TQCString & subtype ) [virtual slot] -

    -Pastes the text with format subtype from the clipboard into the -text edit at the current cursor position. The subtype can be -"plain" or "html". -

    If there is no text with format subtype in the clipboard -nothing happens. -

    See also paste(), cut(), and TQTextEdit::copy(). - -

    void TQTextEdit::placeCursor ( const TQPoint & pos, TQTextCursor * c = 0 ) [virtual slot] -

    -Places the cursor c at the character which is closest to position -pos (in contents coordinates). If c is 0, the default text -cursor is used. -

    See also setCursorPosition(). - -

    int TQTextEdit::pointSize () const -

    -Returns the point size of the font of the current format. -

    See also setFamily(), setCurrentFont(), and setPointSize(). - -

    void TQTextEdit::redo () [virtual slot] -

    -Redoes the last operation. -

    If there is no operation to redo, i.e. there is no redo step in -the undo/redo history, nothing happens. -

    See also redoAvailable(), undo(), and undoDepth. - -

    void TQTextEdit::redoAvailable ( bool yes ) [signal] -

    - -

    This signal is emitted when the availability of redo changes. If -yes is TRUE, then redo() will work until redoAvailable( FALSE ) -is next emitted. -

    See also redo() and undoDepth. - -

    void TQTextEdit::removeParagraph ( int para ) [virtual slot] -

    -Removes the paragraph para. - -

    void TQTextEdit::removeSelectedText ( int selNum = 0 ) [virtual slot] -

    -Deletes the text of selection selNum (by default, the default -selection, 0). If there is no selected text nothing happens. -

    See also selectedText and removeSelection(). - -

    void TQTextEdit::removeSelection ( int selNum = 0 ) [virtual slot] -

    -Removes the selection selNum (by default 0). This does not -remove the selected text. -

    See also removeSelectedText(). - -

    void TQTextEdit::repaintChanged () [protected] -

    -Repaints any paragraphs that have changed. -

    Although used extensively internally you shouldn't need to call -this yourself. - -

    void TQTextEdit::returnPressed () [signal] -

    - -

    This signal is emitted if the user pressed the Return or the Enter -key. - -

    void TQTextEdit::scrollToAnchor ( const TQString & name ) [virtual slot] -

    -Scrolls the text edit to make the text at the anchor called name visible, if it can be found in the document. If the anchor -isn't found no scrolling will occur. An anchor is defined using -the HTML anchor tag, e.g. <a name="target">. - -

    void TQTextEdit::scrollToBottom () [virtual slot] -

    -Scrolls to the bottom of the document and does formatting if -required. - -

    void TQTextEdit::selectAll ( bool select = TRUE ) [virtual slot] -

    -If select is TRUE (the default), all the text is selected as -selection 0. If select is FALSE any selected text is -unselected, i.e. the default selection (selection 0) is cleared. -

    See also selectedText. - -

    TQString TQTextEdit::selectedText () const -

    Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). -See the "selectedText" property for details. -

    void TQTextEdit::selectionChanged () [signal] -

    - -

    This signal is emitted whenever the selection changes. -

    See also setSelection() and copyAvailable(). - -

    void TQTextEdit::setAlignment ( int a ) [virtual slot] -

    -Sets the alignment of the current paragraph to a. Valid -alignments are TQt::AlignLeft, TQt::AlignRight, -TQt::AlignJustify and TQt::AlignCenter (which centers -horizontally). - -

    Reimplemented in TQMultiLineEdit. -

    void TQTextEdit::setAutoFormatting ( uint features ) -

    Sets the enabled set of auto formatting features to features. -See the "autoFormatting" property for details. -

    void TQTextEdit::setBold ( bool b ) [virtual slot] -

    -If b is TRUE sets the current format to bold; otherwise sets -the current format to non-bold. -

    See also bold(). - -

    void TQTextEdit::setColor ( const TQColor & c ) [virtual slot] -

    -Sets the color of the current format, i.e. of the text, to c. -

    See also color() and paper. - -

    void TQTextEdit::setCurrentFont ( const TQFont & f ) [virtual slot] -

    - -

    Sets the font of the current format to f. -

    If the widget is in LogText mode this function will do -nothing. Use setFont() instead. -

    See also currentFont(), setPointSize(), and setFamily(). - -

    void TQTextEdit::setCursorPosition ( int para, int index ) [virtual slot] -

    -Sets the cursor to position index in paragraph para. -

    See also getCursorPosition(). - -

    void TQTextEdit::setFamily ( const TQString & fontFamily ) [virtual slot] -

    -Sets the font family of the current format to fontFamily. -

    See also family() and setCurrentFont(). - -

    void TQTextEdit::setItalic ( bool b ) [virtual slot] -

    -If b is TRUE sets the current format to italic; otherwise sets -the current format to non-italic. -

    See also italic(). - -

    void TQTextEdit::setLinkUnderline ( bool ) [virtual slot] -

    Sets whether hypertext links will be underlined. -See the "linkUnderline" property for details. -

    void TQTextEdit::setMaxLogLines ( int limit ) [slot] -

    -Sets the maximum number of lines a TQTextEdit can hold in LogText mode to limit. If limit is -1 (the default), this -signifies an unlimited number of lines. -

    Warning: Never use formatting tags that span more than one line -when the maximum log lines is set. When lines are removed from the -top of the buffer it could result in an unbalanced tag pair, i.e. -the left formatting tag is removed before the right one. - -

    void TQTextEdit::setMimeSourceFactory ( TQMimeSourceFactory * factory ) [virtual slot] -

    -Sets the text edit's mimesource factory to factory. See -TQMimeSourceFactory for further details. -

    See also mimeSourceFactory(). - -

    void TQTextEdit::setModified ( bool m ) [virtual slot] -

    Sets whether the document has been modified by the user to m. -See the "modified" property for details. -

    void TQTextEdit::setOverwriteMode ( bool b ) [virtual slot] -

    Sets the text edit's overwrite mode to b. -See the "overwriteMode" property for details. -

    void TQTextEdit::setPaper ( const TQBrush & pap ) [virtual slot] -

    Sets the background (paper) brush to pap. -See the "paper" property for details. -

    void TQTextEdit::setParagraphBackgroundColor ( int para, const TQColor & bg ) [virtual slot] -

    -Sets the background color of the paragraph para to bg. - -

    void TQTextEdit::setPointSize ( int s ) [virtual slot] -

    -Sets the point size of the current format to s. -

    Note that if s is zero or negative, the behaviour of this -function is not defined. -

    See also pointSize(), setCurrentFont(), and setFamily(). - -

    void TQTextEdit::setReadOnly ( bool b ) [virtual slot] -

    Sets whether the text edit is read-only to b. -See the "readOnly" property for details. -

    void TQTextEdit::setSelection ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 ) [virtual slot] -

    -Sets a selection which starts at position indexFrom in -paragraph paraFrom and ends at position indexTo in paragraph -paraTo. -

    Any existing selections which have a different id (selNum) are -left alone, but if an existing selection has the same id as selNum it is removed and replaced by this selection. -

    Uses the selection settings of selection selNum. If selNum -is 0, this is the default selection. -

    The cursor is moved to the end of the selection if selNum is 0, -otherwise the cursor position remains unchanged. -

    See also getSelection() and selectedText. - -

    void TQTextEdit::setSelectionAttributes ( int selNum, const TQColor & back, bool invertText ) [virtual slot] -

    -Sets the background color of selection number selNum to back -and specifies whether the text of this selection should be -inverted with invertText. -

    This only works for selNum > 0. The default selection (selNum == 0) gets its attributes from the text edit's -colorGroup(). - -

    void TQTextEdit::setStyleSheet ( TQStyleSheet * styleSheet ) [virtual slot] -

    -Sets the stylesheet to use with this text edit to styleSheet. -Changes will only take effect for new text added with setText() or -append(). -

    See also styleSheet(). - -

    void TQTextEdit::setTabChangesFocus ( bool b ) [slot] -

    Sets whether TAB changes focus or is accepted as input to b. -See the "tabChangesFocus" property for details. -

    void TQTextEdit::setTabStopWidth ( int ts ) [virtual slot] -

    Sets the tab stop width in pixels to ts. -See the "tabStopWidth" property for details. -

    void TQTextEdit::setText ( const TQString & txt ) [slot] -

    Sets the text edit's text to txt. -See the "text" property for details. -

    void TQTextEdit::setText ( const TQString & text, const TQString & context ) [virtual slot] -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Changes the text of the text edit to the string text and the -context to context. Any previous text is removed. -

    text may be interpreted either as plain text or as rich text, -depending on the textFormat(). The default setting is AutoText, -i.e. the text edit auto-detects the format from text. -

    For rich text the rendering style and available tags are defined -by a styleSheet(); see TQStyleSheet for details. -

    The optional context is a path which the text edit's -TQMimeSourceFactory uses to resolve the locations of files and -images. (See TQTextEdit::TQTextEdit().) It is passed to the text -edit's TQMimeSourceFactory when quering data. -

    Note that the undo/redo history is cleared by this function. -

    See also text and textFormat. - -

    void TQTextEdit::setTextFormat ( TextFormat f ) [virtual slot] -

    Sets the text format: rich text, plain text, log text or auto text to f. -See the "textFormat" property for details. -

    void TQTextEdit::setUnderline ( bool b ) [virtual slot] -

    -If b is TRUE sets the current format to underline; otherwise -sets the current format to non-underline. -

    See also underline(). - -

    void TQTextEdit::setUndoDepth ( int d ) [virtual slot] -

    Sets the depth of the undo history to d. -See the "undoDepth" property for details. -

    void TQTextEdit::setUndoRedoEnabled ( bool b ) [virtual slot] -

    Sets whether undo/redo is enabled to b. -See the "undoRedoEnabled" property for details. -

    void TQTextEdit::setVerticalAlignment ( VerticalAlignment a ) [virtual slot] -

    -Sets the vertical alignment of the current format, i.e. of the -text, to a. -

    See also color() and paper. - -

    void TQTextEdit::setWordWrap ( WordWrap mode ) [virtual slot] -

    Sets the word wrap mode to mode. -See the "wordWrap" property for details. -

    void TQTextEdit::setWrapColumnOrWidth ( int ) [virtual slot] -

    Sets the position (in pixels or columns depending on the wrap mode) where text will be wrapped. -See the "wrapColumnOrWidth" property for details. -

    void TQTextEdit::setWrapPolicy ( WrapPolicy policy ) [virtual slot] -

    Sets the word wrap policy, at whitespace or anywhere to policy. -See the "wrapPolicy" property for details. -

    TQStyleSheet * TQTextEdit::styleSheet () const -

    -Returns the TQStyleSheet which is being used by this text edit. -

    See also setStyleSheet(). - -

    Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, and mdi/application.cpp. -

    void TQTextEdit::sync () [virtual slot] -

    -TQTextEdit is optimized for large amounts text. One of its -optimizations is to format only the visible text, formatting the rest -on demand, e.g. as the user scrolls, so you don't usually need to -call this function. -

    In some situations you may want to force the whole text -to be formatted. For example, if after calling setText(), you wanted -to know the height of the document (using contentsHeight()), you -would call this function first. - -

    TQSyntaxHighlighter * TQTextEdit::syntaxHighlighter () const -

    -Returns the TQSyntaxHighlighter set on this TQTextEdit. 0 is -returned if no syntax highlighter is set. - -

    bool TQTextEdit::tabChangesFocus () const -

    Returns TRUE if TAB changes focus or is accepted as input; otherwise returns FALSE. -See the "tabChangesFocus" property for details. -

    int TQTextEdit::tabStopWidth () const -

    Returns the tab stop width in pixels. -See the "tabStopWidth" property for details. -

    TQString TQTextEdit::text () const -

    Returns the text edit's text. -See the "text" property for details. -

    TQString TQTextEdit::text ( int para ) const -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Returns the text of paragraph para. -

    If textFormat() is RichText the text will contain HTML -formatting tags. - -

    void TQTextEdit::textChanged () [signal] -

    - -

    This signal is emitted whenever the text in the text edit changes. -

    See also text and append(). - -

    Examples: qwerty/qwerty.cpp and rot13/rot13.cpp. -

    TQTextCursor * TQTextEdit::textCursor () const [protected] -

    - -

    Returns the text edit's text cursor. -

    Warning: TQTextCursor is not in the public API, but in special -circumstances you might wish to use it. - -

    TextFormat TQTextEdit::textFormat () const -

    Returns the text format: rich text, plain text, log text or auto text. -See the "textFormat" property for details. -

    bool TQTextEdit::underline () const -

    -Returns TRUE if the current format is underlined; otherwise returns -FALSE. -

    See also setUnderline(). - -

    void TQTextEdit::undo () [virtual slot] -

    -Undoes the last operation. -

    If there is no operation to undo, i.e. there is no undo step in -the undo/redo history, nothing happens. -

    See also undoAvailable(), redo(), and undoDepth. - -

    void TQTextEdit::undoAvailable ( bool yes ) [signal] -

    - -

    This signal is emitted when the availability of undo changes. If -yes is TRUE, then undo() will work until undoAvailable( FALSE ) -is next emitted. -

    See also undo() and undoDepth. - -

    int TQTextEdit::undoDepth () const -

    Returns the depth of the undo history. -See the "undoDepth" property for details. -

    WordWrap TQTextEdit::wordWrap () const -

    Returns the word wrap mode. -See the "wordWrap" property for details. -

    int TQTextEdit::wrapColumnOrWidth () const -

    Returns the position (in pixels or columns depending on the wrap mode) where text will be wrapped. -See the "wrapColumnOrWidth" property for details. -

    WrapPolicy TQTextEdit::wrapPolicy () const -

    Returns the word wrap policy, at whitespace or anywhere. -See the "wrapPolicy" property for details. -

    void TQTextEdit::zoomIn ( int range ) [virtual slot] -

    -Zooms in on the text by making the base font size range -points larger and recalculating all font sizes to be the new size. -This does not change the size of any images. -

    See also zoomOut(). - -

    void TQTextEdit::zoomIn () [virtual slot] -

    - -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Zooms in on the text by making the base font size one point -larger and recalculating all font sizes to be the new size. This -does not change the size of any images. -

    See also zoomOut(). - -

    void TQTextEdit::zoomOut ( int range ) [virtual slot] -

    -Zooms out on the text by making the base font size range points -smaller and recalculating all font sizes to be the new size. This -does not change the size of any images. -

    See also zoomIn(). - -

    void TQTextEdit::zoomOut () [virtual slot] -

    - -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Zooms out on the text by making the base font size one point -smaller and recalculating all font sizes to be the new size. This -does not change the size of any images. -

    See also zoomIn(). - -

    void TQTextEdit::zoomTo ( int size ) [virtual slot] -

    -Zooms the text by making the base font size size points and -recalculating all font sizes to be the new size. This does not -change the size of any images. - -

    Property Documentation

    -

    AutoFormatting autoFormatting

    -

    This property holds the enabled set of auto formatting features. -

    The value can be any combination of the values in the AutoFormatting enum. The default is AutoAll. Choose AutoNone -to disable all automatic formatting. -

    Currently, the only automatic formatting feature provided is AutoBulletList; future versions of TQt may offer more. - -

    Set this property's value with setAutoFormatting() and get this property's value with autoFormatting(). -

    TQString documentTitle

    -

    This property holds the title of the document parsed from the text. -

    For PlainText the title will be an empty string. For RichText the title will be the text between the <title> tags, -if present, otherwise an empty string. - -

    Get this property's value with documentTitle(). -

    bool hasSelectedText

    -

    This property holds whether some text is selected in selection 0. -

    -

    Get this property's value with hasSelectedText(). -

    int length

    -

    This property holds the number of characters in the text. -

    -

    Get this property's value with length(). -

    bool linkUnderline

    -

    This property holds whether hypertext links will be underlined. -

    If TRUE (the default) hypertext links will be displayed -underlined. If FALSE links will not be displayed underlined. - -

    Set this property's value with setLinkUnderline() and get this property's value with linkUnderline(). -

    bool modified

    -

    This property holds whether the document has been modified by the user. -

    -

    Set this property's value with setModified() and get this property's value with isModified(). -

    bool overwriteMode

    -

    This property holds the text edit's overwrite mode. -

    If FALSE (the default) characters entered by the user are inserted -with any characters to the right being moved out of the way. If -TRUE, the editor is in overwrite mode, i.e. characters entered by -the user overwrite any characters to the right of the cursor -position. - -

    Set this property's value with setOverwriteMode() and get this property's value with isOverwriteMode(). -

    TQBrush paper

    -

    This property holds the background (paper) brush. -

    The brush that is currently used to draw the background of the -text edit. The initial setting is an empty brush. - -

    Set this property's value with setPaper() and get this property's value with paper(). -

    bool readOnly

    -

    This property holds whether the text edit is read-only. -

    In a read-only text edit the user can only navigate through the -text and select text; modifying the text is not possible. -

    This property's default is FALSE. - -

    Set this property's value with setReadOnly() and get this property's value with isReadOnly(). -

    TQString selectedText

    -

    This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). -

    The text is always returned as PlainText if the textFormat() is -PlainText or AutoText, otherwise it is returned as HTML. -

    See also hasSelectedText. - -

    Get this property's value with selectedText(). -

    bool tabChangesFocus

    This property holds whether TAB changes focus or is accepted as input. -

    In some occasions text edits should not allow the user to input -tabulators or change indentation using the TAB key, as this breaks -the focus chain. The default is FALSE. -

    -

    Set this property's value with setTabChangesFocus() and get this property's value with tabChangesFocus(). -

    int tabStopWidth

    -

    This property holds the tab stop width in pixels. -

    -

    Set this property's value with setTabStopWidth() and get this property's value with tabStopWidth(). -

    TQString text

    -

    This property holds the text edit's text. -

    There is no default text. -

    On setting, any previous text is deleted. -

    The text may be interpreted either as plain text or as rich text, -depending on the textFormat(). The default setting is AutoText, -i.e. the text edit auto-detects the format of the text. -

    For richtext, calling text() on an editable TQTextEdit will cause -the text to be regenerated from the textedit. This may mean that -the TQString returned may not be exactly the same as the one that -was set. -

    See also textFormat. - -

    Set this property's value with setText() and get this property's value with text(). -

    TextFormat textFormat

    -

    This property holds the text format: rich text, plain text, log text or auto text. -

    The text format is one of the following: -

      -
    • PlainText - all characters, except newlines, are displayed -verbatim, including spaces. Whenever a newline appears in the text -the text edit inserts a hard line break and begins a new -paragraph. -
    • RichText - rich text rendering. The available styles are -defined in the default stylesheet TQStyleSheet::defaultSheet(). -
    • LogText - optimized mode for very large texts. Supports a very -limited set of formatting tags (color, bold, underline and italic -settings). -
    • AutoText - this is the default. The text edit autodetects which -rendering style is best, PlainText or RichText. This is done -by using the TQStyleSheet::mightBeRichText() function. -
    - -

    Set this property's value with setTextFormat() and get this property's value with textFormat(). -

    int undoDepth

    -

    This property holds the depth of the undo history. -

    The maximum number of steps in the undo/redo history. The default -is 100. -

    See also undo() and redo(). - -

    Set this property's value with setUndoDepth() and get this property's value with undoDepth(). -

    bool undoRedoEnabled

    -

    This property holds whether undo/redo is enabled. -

    When changing this property, the undo/redo history is cleared. -

    The default is TRUE. - -

    Set this property's value with setUndoRedoEnabled() and get this property's value with isUndoRedoEnabled(). -

    WordWrap wordWrap

    -

    This property holds the word wrap mode. -

    The default mode is WidgetWidth which causes words to be -wrapped at the right edge of the text edit. Wrapping occurs at -whitespace, keeping whole words intact. If you want wrapping to -occur within words use setWrapPolicy(). If you set a wrap mode of -FixedPixelWidth or FixedColumnWidth you should also call -setWrapColumnOrWidth() with the width you want. -

    See also WordWrap, wrapColumnOrWidth, and wrapPolicy. - -

    Set this property's value with setWordWrap() and get this property's value with wordWrap(). -

    int wrapColumnOrWidth

    -

    This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped. -

    If the wrap mode is FixedPixelWidth, the value is the number of -pixels from the left edge of the text edit at which text should be -wrapped. If the wrap mode is FixedColumnWidth, the value is the -column number (in character columns) from the left edge of the -text edit at which text should be wrapped. -

    See also wordWrap. - -

    Set this property's value with setWrapColumnOrWidth() and get this property's value with wrapColumnOrWidth(). -

    WrapPolicy wrapPolicy

    -

    This property holds the word wrap policy, at whitespace or anywhere. -

    Defines where text can be wrapped when word wrap mode is not NoWrap. The choices are AtWordBoundary (the default), Anywhere and AtWordOrDocumentBoundary -

    See also wordWrap. - -

    Set this property's value with setWrapPolicy() and get this property's value with wrapPolicy(). - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqtextstream.html b/doc/html/ntqtextstream.html deleted file mode 100644 index 557c3375..00000000 --- a/doc/html/ntqtextstream.html +++ /dev/null @@ -1,667 +0,0 @@ - - - - - -TQTextStream Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextStream Class Reference

    - -

    The TQTextStream class provides basic functions for reading -and writing text using a TQIODevice. -More... -

    All the functions in this class are reentrant when TQt is built with thread support.

    -

    #include <ntqtextstream.h> -

    Inherited by TQTextIStream and TQTextOStream. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - - -The TQTextStream class provides basic functions for reading -and writing text using a TQIODevice. -

    - - -

    The text stream class has a functional interface that is very -similar to that of the standard C++ iostream class. -

    TQt provides several global functions similar to the ones in iostream: -

    -
    Function Meaning -
    bin sets the TQTextStream to read/write binary numbers -
    oct sets the TQTextStream to read/write octal numbers -
    dec sets the TQTextStream to read/write decimal numbers -
    hex sets the TQTextStream to read/write hexadecimal numbers -
    endl forces a line break -
    flush forces the TQIODevice to flush any buffered data -
    ws eats any available whitespace (on input) -
    reset resets the TQTextStream to its default mode (see reset()) -
    qSetW(int) sets the field width -to the given argument -
    qSetFill(int) sets the fill character to the given argument -
    qSetPrecision(int) sets the precision to the given argument -
    -

    Warning: By default TQTextStream will automatically detect whether -integers in the stream are in decimal, octal, hexadecimal or -binary format when reading from the stream. In particular, a -leading '0' signifies octal, i.e. the sequence "0100" will be -interpreted as 64. -

    The TQTextStream class reads and writes text; it is not appropriate -for dealing with binary data (but TQDataStream is). -

    By default, output of Unicode text (i.e. TQString) is done using -the local 8-bit encoding. This can be changed using the -setEncoding() method. For input, the TQTextStream will auto-detect -standard Unicode "byte order marked" text files; otherwise the -local 8-bit encoding is used. -

    The TQIODevice is set in the constructor, or later using -setDevice(). If the end of the input is reached atEnd() returns -TRUE. Data can be read into variables of the appropriate type -using the operator>>() overloads, or read in its entirety into a -single string using read(), or read a line at a time using -readLine(). Whitespace can be skipped over using skipWhiteSpace(). -You can set flags for the stream using flags() or setf(). The -stream also supports width(), precision() and fill(); use reset() -to reset the defaults. -

    See also TQDataStream, Input/Output and Networking, and Text Related Classes. - -


    Member Type Documentation

    -

    TQTextStream::Encoding

    - -
      -
    • TQTextStream::Locale -
    • TQTextStream::Latin1 -
    • TQTextStream::Unicode -
    • TQTextStream::UnicodeNetworkOrder -
    • TQTextStream::UnicodeReverse -
    • TQTextStream::RawUnicode -
    • TQTextStream::UnicodeUTF8 -

    See setEncoding() for an explanation of the encodings. - -


    Member Function Documentation

    -

    TQTextStream::TQTextStream () -

    -Constructs a data stream that has no IO device. - -

    TQTextStream::TQTextStream ( TQIODevice * iod ) -

    -Constructs a text stream that uses the IO device iod. - -

    TQTextStream::TQTextStream ( TQString * str, int filemode ) -

    -Constructs a text stream that operates on the Unicode TQString, str, through an internal device. The filemode argument is -passed to the device's open() function; see TQIODevice::mode(). -

    If you set an encoding or codec with setEncoding() or setCodec(), -this setting is ignored for text streams that operate on TQString. -

    Example: -

    -    TQString str;
    -    TQTextStream ts( &str, IO_WriteOnly );
    -    ts << "pi = " << 3.14; // str == "pi = 3.14"
    -    
    - -

    Writing data to the text stream will modify the contents of the -string. The string will be expanded when data is written beyond -the end of the string. Note that the string will not be truncated: -

    -    TQString str = "pi = 3.14";
    -    TQTextStream ts( &str, IO_WriteOnly );
    -    ts <<  "2+2 = " << 2+2; // str == "2+2 = 414"
    -    
    - -

    Note that because TQString is Unicode, you should not use -readRawBytes() or writeRawBytes() on such a stream. - -

    TQTextStream::TQTextStream ( TQString & str, int filemode ) -

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    This constructor is equivalent to the constructor taking a TQString* -parameter. - -

    TQTextStream::TQTextStream ( TQByteArray a, int mode ) -

    -Constructs a text stream that operates on the byte array, a, -through an internal TQBuffer device. The mode argument is passed -to the device's open() function; see TQIODevice::mode(). -

    Example: -

    -    TQByteArray array;
    -    TQTextStream ts( array, IO_WriteOnly );
    -    ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"
    -    
    - -

    Writing data to the text stream will modify the contents of the -array. The array will be expanded when data is written beyond the -end of the string. -

    Same example, using a TQBuffer: -

    -    TQByteArray array;
    -    TQBuffer buf( array );
    -    buf.open( IO_WriteOnly );
    -    TQTextStream ts( &buf );
    -    ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"
    -    buf.close();
    -    
    - - -

    TQTextStream::TQTextStream ( FILE * fh, int mode ) -

    -Constructs a text stream that operates on an existing file handle -fh through an internal TQFile device. The mode argument is -passed to the device's open() function; see TQIODevice::mode(). -

    Note that if you create a TQTextStream cout or another name that -is also used for another variable of a different type, some -linkers may confuse the two variables, which will often cause -crashes. - -

    TQTextStream::~TQTextStream () [virtual] -

    -Destroys the text stream. -

    The destructor does not affect the current IO device. - -

    bool TQTextStream::atEnd () const -

    - -

    Returns TRUE if the IO device has reached the end position (end of -the stream or file) or if there is no IO device set; otherwise -returns FALSE. -

    See also TQIODevice::atEnd(). - -

    Examples: addressbook/centralwidget.cpp and grapher/grapher.cpp. -

    TQTextCodec * TQTextStream::codec () -

    -Returns the codec actually used for this stream. -

    If Unicode is automatically detected in input, a codec with name() "ISO-10646-UCS-2" is returned. -

    See also setCodec(). - -

    TQIODevice * TQTextStream::device () const -

    - -

    Returns the IO device currently set. -

    See also setDevice() and unsetDevice(). - -

    bool TQTextStream::eof () const -

    -

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    This function has been renamed to atEnd(). -

    See also TQIODevice::atEnd(). - -

    Example: chart/chartform_files.cpp. -

    int TQTextStream::fill () const -

    - -

    Returns the fill character. The default value is ' ' (space). - -

    int TQTextStream::fill ( int f ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Sets the fill character to f. Returns the previous fill character. - -

    int TQTextStream::flags () const -

    - -

    Returns the current stream flags. The default value is 0. -

    -
    Flag Meaning -
    skipws Not currently used; whitespace always skipped -
    left Numeric fields are left-aligned -
    right -Not currently used (by default, numerics are right-aligned) -
    internal Puts any padding spaces between +/- and value -
    bin Output and input only in binary -
    oct Output and input only in octal -
    dec Output and input only in decimal -
    hex Output and input only in hexadecimal -
    showbase -Annotates numeric outputs with 0b, 0, or 0x if in bin, -oct, or hex format -
    showpoint Not currently used -
    uppercase Uses 0B and 0X rather than 0b and 0x -
    showpos Shows + for positive numeric values -
    scientific Uses scientific notation for floating point values -
    fixed Uses fixed-point notation for floating point values -
    -

    Note that unless bin, oct, dec, or hex is set, the -input base is octal if the value starts with 0, hexadecimal if it -starts with 0x, binary if it starts with 0b, and decimal -otherwise. -

    See also setf() and unsetf(). - -

    int TQTextStream::flags ( int f ) -

    - -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Sets the stream flags to f. Returns the previous stream flags. -

    See also setf() and unsetf(). - -

    TQTextStream & TQTextStream::operator<< ( TQChar c ) -

    -Writes character char to the stream and returns a reference to -the stream. -

    The character c is assumed to be Latin1 encoded independent of -the Encoding set for the TQTextStream. - -

    TQTextStream & TQTextStream::operator<< ( char c ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes character c to the stream and returns a reference to the -stream. - -

    TQTextStream & TQTextStream::operator<< ( signed short i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes a short integer i to the stream and returns a -reference to the stream. - -

    TQTextStream & TQTextStream::operator<< ( unsigned short i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes an unsigned short integer i to the stream and -returns a reference to the stream. - -

    TQTextStream & TQTextStream::operator<< ( signed int i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes an int i to the stream and returns a reference to the -stream. - -

    TQTextStream & TQTextStream::operator<< ( unsigned int i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes an unsigned int i to the stream and returns a -reference to the stream. - -

    TQTextStream & TQTextStream::operator<< ( signed long i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes a long int i to the stream and returns a reference -to the stream. - -

    TQTextStream & TQTextStream::operator<< ( unsigned long i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes an unsigned long int i to the stream and -returns a reference to the stream. - -

    TQTextStream & TQTextStream::operator<< ( float f ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes a float f to the stream and returns a reference to -the stream. - -

    TQTextStream & TQTextStream::operator<< ( double f ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes a double f to the stream and returns a reference to -the stream. - -

    TQTextStream & TQTextStream::operator<< ( const char * s ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes a string to the stream and returns a reference to the -stream. -

    The string s is assumed to be Latin1 encoded independent of the -Encoding set for the TQTextStream. - -

    TQTextStream & TQTextStream::operator<< ( const TQString & s ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes s to the stream and returns a reference to the stream. - -

    TQTextStream & TQTextStream::operator<< ( const TQCString & s ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes s to the stream and returns a reference to the stream. -

    The string s is assumed to be Latin1 encoded independent of the -Encoding set for the TQTextStream. - -

    TQTextStream & TQTextStream::operator<< ( void * ptr ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Writes a pointer to the stream and returns a reference to the -stream. -

    The ptr is output as an unsigned long hexadecimal integer. - -

    TQTextStream & TQTextStream::operator>> ( TQChar & c ) -

    -Reads a char c from the stream and returns a reference to the -stream. Note that whitespace is not skipped. - -

    TQTextStream & TQTextStream::operator>> ( char & c ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a char c from the stream and returns a reference to the -stream. Note that whitespace is skipped. - -

    TQTextStream & TQTextStream::operator>> ( signed short & i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a signed short integer i from the stream and returns a -reference to the stream. See flags() for an explanation of the -expected input format. - -

    TQTextStream & TQTextStream::operator>> ( unsigned short & i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads an unsigned short integer i from the stream and -returns a reference to the stream. See flags() for an explanation -of the expected input format. - -

    TQTextStream & TQTextStream::operator>> ( signed int & i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a signed int i from the stream and returns a reference -to the stream. See flags() for an explanation of the expected -input format. - -

    TQTextStream & TQTextStream::operator>> ( unsigned int & i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads an unsigned int i from the stream and returns a -reference to the stream. See flags() for an explanation of the -expected input format. - -

    TQTextStream & TQTextStream::operator>> ( signed long & i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a signed long int i from the stream and returns a -reference to the stream. See flags() for an explanation of the -expected input format. - -

    TQTextStream & TQTextStream::operator>> ( unsigned long & i ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads an unsigned long int i from the stream and returns a -reference to the stream. See flags() for an explanation of the -expected input format. - -

    TQTextStream & TQTextStream::operator>> ( float & f ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a float f from the stream and returns a reference to -the stream. See flags() for an explanation of the expected input -format. - -

    TQTextStream & TQTextStream::operator>> ( double & f ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a double f from the stream and returns a reference to -the stream. See flags() for an explanation of the expected input -format. - -

    TQTextStream & TQTextStream::operator>> ( char * s ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a "word" from the stream into s and returns a reference -to the stream. -

    A word consists of characters for which isspace() returns FALSE. - -

    TQTextStream & TQTextStream::operator>> ( TQString & str ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a "word" from the stream into str and returns a reference -to the stream. -

    A word consists of characters for which isspace() returns FALSE. - -

    TQTextStream & TQTextStream::operator>> ( TQCString & str ) -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Reads a "word" from the stream into str and returns a reference -to the stream. -

    A word consists of characters for which isspace() returns FALSE. - -

    int TQTextStream::precision () const -

    - -

    Returns the precision. The default value is 6. - -

    int TQTextStream::precision ( int p ) -

    - -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Sets the precision to p. Returns the previous precision setting. - -

    TQString TQTextStream::read () -

    -Reads the entire stream from the current position, and returns a string -containing the text. -

    See also TQIODevice::readLine(). - -

    Examples: action/application.cpp, application/application.cpp, mdi/application.cpp, qdir/qdir.cpp, and qwerty/qwerty.cpp. -

    TQString TQTextStream::readLine () -

    -Reads a line from the stream and returns a string containing the -text. -

    The returned string does not contain any trailing newline or -carriage return. Note that this is different from -TQIODevice::readLine(), which does not strip the newline at the end -of the line. -

    On EOF you will get a TQString that is null. On reading an empty -line the returned TQString is empty but not null. -

    See also TQIODevice::readLine(). - -

    Examples: addressbook/centralwidget.cpp, chart/element.cpp, and network/clientserver/server/server.cpp. -

    TQTextStream & TQTextStream::readRawBytes ( char * s, uint len ) -

    -Reads len bytes from the stream into s and returns a -reference to the stream. -

    The buffer s must be preallocated. -

    Note that no encoding is done by this function. -

    Warning: The behavior of this function is undefined unless the -stream's encoding is set to Unicode or Latin1. -

    See also TQIODevice::readBlock(). - -

    void TQTextStream::reset () -

    -Resets the text stream. -

      -
    • All flags are set to 0. -
    • The field width is set to 0. -
    • The fill character is set to ' ' (Space). -
    • The precision is set to 6. -
    -

    See also setf(), width(), fill(), and precision(). - -

    void TQTextStream::setCodec ( TQTextCodec * codec ) -

    -Sets the codec for this stream to codec. Will not try to -autodetect Unicode. -

    Note that this function should be called before any data is read -to/written from the stream. -

    See also setEncoding() and codec(). - -

    Example: qwerty/qwerty.cpp. -

    void TQTextStream::setDevice ( TQIODevice * iod ) -

    -Sets the IO device to iod. -

    See also device() and unsetDevice(). - -

    void TQTextStream::setEncoding ( Encoding e ) -

    -Sets the encoding of this stream to e, where e is one of the -following values: -
    -
    Encoding Meaning -
    Locale -Uses local file format (Latin1 if locale is not set), but -autodetecting Unicode(utf16) on input. -
    Unicode -Uses Unicode(utf16) for input and output. Output will be -written in the order most efficient for the current platform -(i.e. the order used internally in TQString). -
    UnicodeUTF8 -Using Unicode(utf8) for input and output. If you use it for -input it will autodetect utf16 and use it instead of utf8. -
    Latin1 -ISO-8859-1. Will not autodetect utf16. -
    UnicodeNetworkOrder -Uses network order Unicode(utf16) for input and output. -Useful when reading Unicode data that does not start with the -byte order marker. -
    UnicodeReverse -Uses reverse network order Unicode(utf16) for input and -output. Useful when reading Unicode data that does not start -with the byte order marker or when writing data that should be -read by buggy Windows applications. -
    RawUnicode -Like Unicode, but does not write the byte order marker nor -does it auto-detect the byte order. Useful only when writing to -non-persistent storage used by a single process. -
    -

    Locale and all Unicode encodings, except RawUnicode, will look -at the first two bytes in an input stream to determine the byte -order. The initial byte order marker will be stripped off before -data is read. -

    Note that this function should be called before any data is read to -or written from the stream. -

    See also setCodec(). - -

    Examples: addressbook/centralwidget.cpp, network/httpd/httpd.cpp, and qwerty/qwerty.cpp. -

    int TQTextStream::setf ( int bits ) -

    - -

    Sets the stream flag bits bits. Returns the previous stream -flags. -

    Equivalent to flags( flags() | bits ). -

    See also unsetf(). - -

    int TQTextStream::setf ( int bits, int mask ) -

    - -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Sets the stream flag bits bits with a bit mask mask. Returns -the previous stream flags. -

    Equivalent to flags( (flags() & ~mask) | (bits & mask) ). -

    See also unsetf(). - -

    void TQTextStream::skipWhiteSpace () -

    -Positions the read pointer at the first non-whitespace character. - -

    void TQTextStream::unsetDevice () -

    -Unsets the IO device. Equivalent to setDevice( 0 ). -

    See also device() and setDevice(). - -

    int TQTextStream::unsetf ( int bits ) -

    - -

    Clears the stream flag bits bits. Returns the previous stream -flags. -

    Equivalent to flags( flags() & ~mask ). -

    See also setf(). - -

    int TQTextStream::width () const -

    - -

    Returns the field width. The default value is 0. - -

    int TQTextStream::width ( int w ) -

    - -

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Sets the field width to w. Returns the previous field width. - -

    TQTextStream & TQTextStream::writeRawBytes ( const char * s, uint len ) -

    -Writes the len bytes from s to the stream and returns a -reference to the stream. -

    Note that no encoding is done by this function. -

    See also TQIODevice::writeBlock(). - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqtextview.html b/doc/html/ntqtextview.html deleted file mode 100644 index 3666e1e1..00000000 --- a/doc/html/ntqtextview.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - -TQTextView Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextView Class Reference
    [obsolete]

    - -

    The TQTextView class provides a rich-text viewer. -More... -

    #include <ntqtextview.h> -

    Inherits TQTextEdit. -

    List of all member functions. -

    Properties

    -
      -
    • bool modified - whether the text view's contents have been modified  (read only)
    • -
    • bool overwriteMode - whether new text overwrites or pushes aside existing text  (read only)
    • -
    • bool readOnly - whether the text view's contents are read only  (read only)
    • -
    • int undoDepth - the number of undoable steps  (read only)
    • -
    • bool undoRedoEnabled - whether undo and redo are enabled  (read only)
    • -
    -

    Detailed Description

    - -The TQTextView class provides a rich-text viewer. -

    This class is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

    This class wraps a read-only TQTextEdit. -Use a TQTextEdit instead, and call setReadOnly(TRUE) -to disable editing. - -


    Property Documentation

    -

    bool modified

    -

    This property holds whether the text view's contents have been modified. -

    -

    bool overwriteMode

    -

    This property holds whether new text overwrites or pushes aside existing text. -

    -

    bool readOnly

    -

    This property holds whether the text view's contents are read only. -

    -

    int undoDepth

    -

    This property holds the number of undoable steps. -

    -

    bool undoRedoEnabled

    -

    This property holds whether undo and redo are enabled. -

    -

    -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqtsciicodec.html b/doc/html/ntqtsciicodec.html index 6cd76e28..6d27cdd3 100644 --- a/doc/html/ntqtsciicodec.html +++ b/doc/html/ntqtsciicodec.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

    All the functions in this class are reentrant when TQt is built with thread support.

    #include <ntqtsciicodec.h> -

    Inherits TQTextCodec. +

    Inherits TQTextCodec.

    List of all member functions.


    Detailed Description

    diff --git a/doc/html/pictures.html b/doc/html/pictures.html index 15e713fa..3c139f31 100644 --- a/doc/html/pictures.html +++ b/doc/html/pictures.html @@ -48,7 +48,7 @@ bottom there's a TQIconView. a TQMenuBar and some TQToolBars that contain various widgets, e.g. TQToolButtons and TQComboBoxes. The central widget is a TQWorkspace which is used for MDI window management and -which contains an MDI-Window featuring a TQTextEdit. At the bottom +which contains an MDI-Window featuring a TQTextEdit. At the bottom you see a TQStatusBar and at the bottom-right a TQSizeGrip.

    The image below shows a TQFileDialog. On the Macintosh and Windows @@ -81,9 +81,9 @@ also be used as a separate widget. more convenient class TQTabWidget, which combines a tab bar with the pages, can be used separately. In the visible page you see a TQLabel, the range controls TQSlider and TQSpinBox and below a TQLCDNumber. In the bottom row there are some TQPushButtons.

    -

    In the screenshot below there's a TQTextBrowser displaying a HTML -page. See also TQTextEdit. -

    +

    In the screenshot below there's a TQTextBrowser displaying a HTML +page. See also TQTextEdit. +


    diff --git a/doc/html/plugins-howto.html b/doc/html/plugins-howto.html index 8c146ccc..320c694f 100644 --- a/doc/html/plugins-howto.html +++ b/doc/html/plugins-howto.html @@ -55,7 +55,7 @@ by default in the standard plugin directory. TQStylePlugin pluginsbase/styles * -TQTextCodecPlugin +TQTextCodecPlugin pluginsbase/codecs * TQWidgetPlugin diff --git a/doc/html/plugins.html b/doc/html/plugins.html index 50f0bb24..da4187cc 100644 --- a/doc/html/plugins.html +++ b/doc/html/plugins.html @@ -46,7 +46,7 @@ Windows. TQMouseDriverPluginAbstract base for TQt/Embedded mouse driver plugins TQSqlDriverPluginAbstract base for custom TQSqlDriver plugins TQStylePluginAbstract base for custom TQStyle plugins -TQTextCodecPluginAbstract base for custom TQTextCodec plugins +TQTextCodecPluginAbstract base for custom TQTextCodec plugins TQWidgetPluginAbstract base for custom TQWidget plugins diff --git a/doc/html/porting.html b/doc/html/porting.html index 701b449f..4a486675 100644 --- a/doc/html/porting.html +++ b/doc/html/porting.html @@ -375,7 +375,7 @@ new code.
  • TQTabDialog::selected( const TQString & )
  • TQTabDialog::selected( const TQString & tabLabel )
  • TQTabDialog::setTabEnabled( const char *name, bool enable ) -
  • TQTextStream::TQTextStream( TQString & str, int filemode ) +
  • TQTextStream::TQTextStream( TQString & str, int filemode )
  • TQToolBar::TQToolBar( const TQString & label, TQMainWindow *, ToolBarDock = DockTop, bool newLine = FALSE, const char *name = 0 )
  • TQToolTip::enabled()
  • TQToolTip::setEnabled( bool enable ) @@ -392,7 +392,7 @@ new code.
  • TQWidget::setPalette( const TQPalette & p, bool )
  • TQWizard::setFinish( TQWidget *, bool )
  • TQXmlInputSource::TQXmlInputSource( TQFile & file ) -
  • TQXmlInputSource::TQXmlInputSource( TQTextStream & stream ) +
  • TQXmlInputSource::TQXmlInputSource( TQTextStream & stream )
  • TQXmlReader::parse( const TQXmlInputSource & input )

    Additionally, these preprocessor directives have been removed: @@ -491,7 +491,7 @@ top level widgets.

    The TQMultiLineEdit was a simple editor widget in previous TQt versions. Since TQt 3.0 includes a new richtext engine, which also supports editing, TQMultiLineEdit is obsolete. For the sake of compatibility -TQMultiLineEdit is still provided. It is now a subclass of TQTextEdit +TQMultiLineEdit is still provided. It is now a subclass of TQTextEdit which wraps the old TQMultiLineEdit so that it is mostly source compatible to keep old applications working.

    For new applications and when maintaining existing applications we @@ -676,7 +676,7 @@ have been removed, together with the following two functions as well.

  • void TQToolButton::setIconSet( const TQIconSet & set )
  • TQIconSet TQToolButton::iconSet() const -

    TQTextStream +

    TQTextStream

    The global TQTextStream manipulators setw(), setfill() and setprecison() were renamed to qSetW(), qSetFill() and qSetPrecision() to avoid conflicts diff --git a/doc/html/process-example.html b/doc/html/process-example.html index 719651b8..9629f295 100644 --- a/doc/html/process-example.html +++ b/doc/html/process-example.html @@ -52,7 +52,7 @@ output of the command. #include <tqobject.h> #include <ntqprocess.h> #include <ntqvbox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqpushbutton.h> #include <ntqapplication.h> #include <ntqmessagebox.h> @@ -73,14 +73,14 @@ public slots: private: TQProcess *proc; - TQTextView *output; + TQTextView *output; TQPushButton *quitButton; }; UicManager::UicManager() { // Layout - output = new TQTextView( this ); + output = new TQTextView( this ); quitButton = new TQPushButton( tr("Quit"), this ); connect( quitButton, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); @@ -116,7 +116,7 @@ void UicManager::readFromStdout() { // Read and process the data. // Bear in mind that the data might be output in chunks. - output->append( proc->readStdout() ); + output->append( proc->readStdout() ); } void UicManager::scrollToTop() diff --git a/doc/html/propertydocs b/doc/html/propertydocs index 7bd06c2e..d85f4827 100644 --- a/doc/html/propertydocs +++ b/doc/html/propertydocs @@ -1966,8 +1966,8 @@ set, the buddy accelerator key is updated from the new text. <p> Note that Qlabel is well-suited to display small rich text documents, i.e. those small documents that get their document specific settings (font, text color, link color) from the label's -palette and font properties. For large documents, use <a href="ntqtextedit.html">QTextEdit</a> -in read-only mode instead. QTextEdit will flicker less on resize +palette and font properties. For large documents, use <a href="tqtextedit.html">TQTextEdit</a> +in read-only mode instead. TQTextEdit will flicker less on resize and can also provide a scrollbar when necessary. <p> <p>See also <a href="ntqlabel.html#textFormat-prop">textFormat</a>, <a href="ntqlabel.html#setBuddy">setBuddy</a>(), and <a href="ntqlabel.html#alignment-prop">alignment</a>. @@ -2733,8 +2733,8 @@ the message box will try to auto-detect the format of the text. QMultiLineEdit::edited <p>This property holds whether the document has been edited by the user. -<p>This is the same as <a href="ntqtextedit.html">QTextEdit</a>'s "modifed" property. -<p> <p>See also <a href="ntqtextedit.html#modified-prop">QTextEdit::modified</a>. +<p>This is the same as <a href="tqtextedit.html">TQTextEdit</a>'s "modifed" property. +<p> <p>See also <a href="tqtextedit.html#modified-prop">TQTextEdit::modified</a>. <p>Set this property's value with <a href="ntqmultilineedit.html#setEdited">setEdited</a>() and get this property's value with <a href="ntqmultilineedit.html#edited">edited</a>(). @@ -3862,19 +3862,19 @@ multiple ranges of cells. - QTextBrowser::source - + TQTextBrowser::source + <p>This property holds the name of the displayed document. <p>This is a <a href="tqstring.html#TQString-null">TQString::null</a> if no document is displayed or if the source is unknown. -<p> Setting this property uses the <a href="ntqtextedit.html#mimeSourceFactory">mimeSourceFactory</a>() to lookup the +<p> Setting this property uses the <a href="tqtextedit.html#mimeSourceFactory">mimeSourceFactory</a>() to lookup the named document. It also checks for optional anchors and scrolls the document accordingly. <p> If the first tag in the document is <tt>&lt;qt type=detail&gt;</tt>, the document is displayed as a popup rather than as new document in the browser window itself. Otherwise, the document is displayed normally in the text browser with the text set to the contents of -the named document with <a href="ntqtextedit.html#setText">setText</a>(). +the named document with <a href="tqtextedit.html#setText">setText</a>(). <p> If you are using the filesystem access capabilities of the mime source factory, you must ensure that the factory knows about the encoding of specified files; otherwise no data will be available. @@ -3882,67 +3882,67 @@ The default factory handles a couple of common file extensions such as <tt>*.html</tt> and <tt>*.txt</tt> with reasonable defaults. See <a href="qmimesourcefactory.html#data">QMimeSourceFactory::data</a>() for details. -<p>Set this property's value with <a href="ntqtextbrowser.html#setSource">setSource</a>() and get this property's value with <a href="ntqtextbrowser.html#source">source</a>(). +<p>Set this property's value with <a href="tqtextbrowser.html#setSource">setSource</a>() and get this property's value with <a href="tqtextbrowser.html#source">source</a>(). - QTextEdit::autoFormatting - + TQTextEdit::autoFormatting + <p>This property holds the enabled set of auto formatting features. -<p>The value can be any combination of the values in the <a href="ntqtextedit.html#AutoFormatting-enum">AutoFormatting</a> enum. The default is <a href="ntqtextedit.html#AutoFormatting-enum">AutoAll</a>. Choose <a href="ntqtextedit.html#AutoFormatting-enum">AutoNone</a> +<p>The value can be any combination of the values in the <a href="tqtextedit.html#AutoFormatting-enum">AutoFormatting</a> enum. The default is <a href="tqtextedit.html#AutoFormatting-enum">AutoAll</a>. Choose <a href="tqtextedit.html#AutoFormatting-enum">AutoNone</a> to disable all automatic formatting. -<p> Currently, the only automatic formatting feature provided is <a href="ntqtextedit.html#AutoFormatting-enum">AutoBulletList</a>; future versions of TQt may offer more. +<p> Currently, the only automatic formatting feature provided is <a href="tqtextedit.html#AutoFormatting-enum">AutoBulletList</a>; future versions of TQt may offer more. -<p>Set this property's value with <a href="ntqtextedit.html#setAutoFormatting">setAutoFormatting</a>() and get this property's value with <a href="ntqtextedit.html#autoFormatting">autoFormatting</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setAutoFormatting">setAutoFormatting</a>() and get this property's value with <a href="tqtextedit.html#autoFormatting">autoFormatting</a>(). - QTextEdit::documentTitle - + TQTextEdit::documentTitle + <p>This property holds the title of the document parsed from the text. <p>For <a href="ntqt.html#TextFormat-enum">PlainText</a> the title will be an empty string. For <a href="ntqt.html#TextFormat-enum">RichText</a> the title will be the text between the <tt>&lt;title&gt;</tt> tags, if present, otherwise an empty string. -<p>Get this property's value with <a href="ntqtextedit.html#documentTitle">documentTitle</a>(). +<p>Get this property's value with <a href="tqtextedit.html#documentTitle">documentTitle</a>(). - QTextEdit::hasSelectedText - + TQTextEdit::hasSelectedText + <p>This property holds whether some text is selected in selection 0. <p> -<p>Get this property's value with <a href="ntqtextedit.html#hasSelectedText">hasSelectedText</a>(). +<p>Get this property's value with <a href="tqtextedit.html#hasSelectedText">hasSelectedText</a>(). - QTextEdit::length - + TQTextEdit::length + <p>This property holds the number of characters in the text. <p> -<p>Get this property's value with <a href="ntqtextedit.html#length">length</a>(). +<p>Get this property's value with <a href="tqtextedit.html#length">length</a>(). - QTextEdit::linkUnderline - + TQTextEdit::linkUnderline + <p>This property holds whether hypertext links will be underlined. <p>If TRUE (the default) hypertext links will be displayed underlined. If FALSE links will not be displayed underlined. -<p>Set this property's value with <a href="ntqtextedit.html#setLinkUnderline">setLinkUnderline</a>() and get this property's value with <a href="ntqtextedit.html#linkUnderline">linkUnderline</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setLinkUnderline">setLinkUnderline</a>() and get this property's value with <a href="tqtextedit.html#linkUnderline">linkUnderline</a>(). - QTextEdit::modified - + TQTextEdit::modified + <p>This property holds whether the document has been modified by the user. <p> -<p>Set this property's value with <a href="ntqtextedit.html#setModified">setModified</a>() and get this property's value with <a href="ntqtextedit.html#isModified">isModified</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setModified">setModified</a>() and get this property's value with <a href="tqtextedit.html#isModified">isModified</a>(). - QTextEdit::overwriteMode - + TQTextEdit::overwriteMode + <p>This property holds the text edit's overwrite mode. <p>If FALSE (the default) characters entered by the user are inserted with any characters to the right being moved out of the way. If @@ -3950,80 +3950,80 @@ TRUE, the editor is in overwrite mode, i.e. characters entered by the user overwrite any characters to the right of the cursor position. -<p>Set this property's value with <a href="ntqtextedit.html#setOverwriteMode">setOverwriteMode</a>() and get this property's value with <a href="ntqtextedit.html#isOverwriteMode">isOverwriteMode</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setOverwriteMode">setOverwriteMode</a>() and get this property's value with <a href="tqtextedit.html#isOverwriteMode">isOverwriteMode</a>(). - QTextEdit::paper - + TQTextEdit::paper + <p>This property holds the background (paper) brush. <p>The brush that is currently used to draw the background of the text edit. The initial setting is an empty brush. -<p>Set this property's value with <a href="ntqtextedit.html#setPaper">setPaper</a>() and get this property's value with <a href="ntqtextedit.html#paper">paper</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setPaper">setPaper</a>() and get this property's value with <a href="tqtextedit.html#paper">paper</a>(). - QTextEdit::readOnly - + TQTextEdit::readOnly + <p>This property holds whether the text edit is read-only. <p>In a read-only text edit the user can only navigate through the text and select text; modifying the text is not possible. <p> This property's default is FALSE. -<p>Set this property's value with <a href="ntqtextedit.html#setReadOnly">setReadOnly</a>() and get this property's value with <a href="ntqtextedit.html#isReadOnly">isReadOnly</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setReadOnly">setReadOnly</a>() and get this property's value with <a href="tqtextedit.html#isReadOnly">isReadOnly</a>(). - QTextEdit::selectedText - + TQTextEdit::selectedText + <p>This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). -<p>The text is always returned as <a href="ntqt.html#TextFormat-enum">PlainText</a> if the <a href="ntqtextedit.html#textFormat">textFormat</a>() is +<p>The text is always returned as <a href="ntqt.html#TextFormat-enum">PlainText</a> if the <a href="tqtextedit.html#textFormat">textFormat</a>() is <a href="ntqt.html#TextFormat-enum">PlainText</a> or <a href="ntqt.html#TextFormat-enum">AutoText</a>, otherwise it is returned as HTML. -<p> <p>See also <a href="ntqtextedit.html#hasSelectedText-prop">hasSelectedText</a>. +<p> <p>See also <a href="tqtextedit.html#hasSelectedText-prop">hasSelectedText</a>. -<p>Get this property's value with <a href="ntqtextedit.html#selectedText">selectedText</a>(). +<p>Get this property's value with <a href="tqtextedit.html#selectedText">selectedText</a>(). - QTextEdit::tabChangesFocus - <p>This property holds whether TAB changes focus or is accepted as input. + TQTextEdit::tabChangesFocus + <p>This property holds whether TAB changes focus or is accepted as input. <p>In some occasions text edits should not allow the user to input tabulators or change indentation using the TAB key, as this breaks the focus chain. The default is FALSE. <p> -<p>Set this property's value with <a href="ntqtextedit.html#setTabChangesFocus">setTabChangesFocus</a>() and get this property's value with <a href="ntqtextedit.html#tabChangesFocus">tabChangesFocus</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setTabChangesFocus">setTabChangesFocus</a>() and get this property's value with <a href="tqtextedit.html#tabChangesFocus">tabChangesFocus</a>(). - QTextEdit::tabStopWidth - + TQTextEdit::tabStopWidth + <p>This property holds the tab stop width in pixels. <p> -<p>Set this property's value with <a href="ntqtextedit.html#setTabStopWidth">setTabStopWidth</a>() and get this property's value with <a href="ntqtextedit.html#tabStopWidth">tabStopWidth</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setTabStopWidth">setTabStopWidth</a>() and get this property's value with <a href="tqtextedit.html#tabStopWidth">tabStopWidth</a>(). - QTextEdit::text - + TQTextEdit::text + <p>This property holds the text edit's text. <p>There is no default text. <p> On setting, any previous text is deleted. <p> The text may be interpreted either as plain text or as rich text, -depending on the <a href="ntqtextedit.html#textFormat">textFormat</a>(). The default setting is <a href="ntqt.html#TextFormat-enum">AutoText</a>, +depending on the <a href="tqtextedit.html#textFormat">textFormat</a>(). The default setting is <a href="ntqt.html#TextFormat-enum">AutoText</a>, i.e. the text edit auto-detects the format of the text. -<p> For richtext, calling <a href="ntqtextedit.html#text">text</a>() on an editable QTextEdit will cause +<p> For richtext, calling <a href="tqtextedit.html#text">text</a>() on an editable TQTextEdit will cause the text to be regenerated from the textedit. This may mean that the <a href="tqstring.html">TQString</a> returned may not be exactly the same as the one that was set. -<p> <p>See also <a href="ntqtextedit.html#textFormat-prop">textFormat</a>. +<p> <p>See also <a href="tqtextedit.html#textFormat-prop">textFormat</a>. -<p>Set this property's value with <a href="ntqtextedit.html#setText">setText</a>() and get this property's value with <a href="ntqtextedit.html#text">text</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setText">setText</a>() and get this property's value with <a href="tqtextedit.html#text">text</a>(). - QTextEdit::textFormat - + TQTextEdit::textFormat + <p>This property holds the text format: rich text, plain text, log text or auto text. <p>The text format is one of the following: <ul> @@ -4041,67 +4041,67 @@ rendering style is best, <a href="ntqt.html#TextFormat-enum">PlainText< by using the <a href="ntqstylesheet.html#mightBeRichText">QStyleSheet::mightBeRichText</a>() function. </ul> -<p>Set this property's value with <a href="ntqtextedit.html#setTextFormat">setTextFormat</a>() and get this property's value with <a href="ntqtextedit.html#textFormat">textFormat</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setTextFormat">setTextFormat</a>() and get this property's value with <a href="tqtextedit.html#textFormat">textFormat</a>(). - QTextEdit::undoDepth - + TQTextEdit::undoDepth + <p>This property holds the depth of the undo history. <p>The maximum number of steps in the undo/redo history. The default is 100. -<p> <p>See also <a href="ntqtextedit.html#undo">undo</a>() and <a href="ntqtextedit.html#redo">redo</a>(). +<p> <p>See also <a href="tqtextedit.html#undo">undo</a>() and <a href="tqtextedit.html#redo">redo</a>(). -<p>Set this property's value with <a href="ntqtextedit.html#setUndoDepth">setUndoDepth</a>() and get this property's value with <a href="ntqtextedit.html#undoDepth">undoDepth</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setUndoDepth">setUndoDepth</a>() and get this property's value with <a href="tqtextedit.html#undoDepth">undoDepth</a>(). - QTextEdit::undoRedoEnabled - + TQTextEdit::undoRedoEnabled + <p>This property holds whether undo/redo is enabled. <p>When changing this property, the undo/redo history is cleared. <p> The default is TRUE. -<p>Set this property's value with <a href="ntqtextedit.html#setUndoRedoEnabled">setUndoRedoEnabled</a>() and get this property's value with <a href="ntqtextedit.html#isUndoRedoEnabled">isUndoRedoEnabled</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setUndoRedoEnabled">setUndoRedoEnabled</a>() and get this property's value with <a href="tqtextedit.html#isUndoRedoEnabled">isUndoRedoEnabled</a>(). - QTextEdit::wordWrap - + TQTextEdit::wordWrap + <p>This property holds the word wrap mode. -<p>The default mode is <a href="ntqtextedit.html#WordWrap-enum">WidgetWidth</a> which causes words to be +<p>The default mode is <a href="tqtextedit.html#WordWrap-enum">WidgetWidth</a> which causes words to be wrapped at the right edge of the text edit. Wrapping occurs at whitespace, keeping whole words intact. If you want wrapping to -occur within words use <a href="ntqtextedit.html#setWrapPolicy">setWrapPolicy</a>(). If you set a wrap mode of -<a href="ntqtextedit.html#WordWrap-enum">FixedPixelWidth</a> or <a href="ntqtextedit.html#WordWrap-enum">FixedColumnWidth</a> you should also call -<a href="ntqtextedit.html#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() with the width you want. -<p> <p>See also <a href="ntqtextedit.html#WordWrap-enum">WordWrap</a>, <a href="ntqtextedit.html#wrapColumnOrWidth-prop">wrapColumnOrWidth</a>, and <a href="ntqtextedit.html#wrapPolicy-prop">wrapPolicy</a>. +occur within words use <a href="tqtextedit.html#setWrapPolicy">setWrapPolicy</a>(). If you set a wrap mode of +<a href="tqtextedit.html#WordWrap-enum">FixedPixelWidth</a> or <a href="tqtextedit.html#WordWrap-enum">FixedColumnWidth</a> you should also call +<a href="tqtextedit.html#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() with the width you want. +<p> <p>See also <a href="tqtextedit.html#WordWrap-enum">WordWrap</a>, <a href="tqtextedit.html#wrapColumnOrWidth-prop">wrapColumnOrWidth</a>, and <a href="tqtextedit.html#wrapPolicy-prop">wrapPolicy</a>. -<p>Set this property's value with <a href="ntqtextedit.html#setWordWrap">setWordWrap</a>() and get this property's value with <a href="ntqtextedit.html#wordWrap">wordWrap</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setWordWrap">setWordWrap</a>() and get this property's value with <a href="tqtextedit.html#wordWrap">wordWrap</a>(). - QTextEdit::wrapColumnOrWidth - + TQTextEdit::wrapColumnOrWidth + <p>This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped. -<p>If the wrap mode is <a href="ntqtextedit.html#WordWrap-enum">FixedPixelWidth</a>, the value is the number of +<p>If the wrap mode is <a href="tqtextedit.html#WordWrap-enum">FixedPixelWidth</a>, the value is the number of pixels from the left edge of the text edit at which text should be -wrapped. If the wrap mode is <a href="ntqtextedit.html#WordWrap-enum">FixedColumnWidth</a>, the value is the +wrapped. If the wrap mode is <a href="tqtextedit.html#WordWrap-enum">FixedColumnWidth</a>, the value is the column number (in character columns) from the left edge of the text edit at which text should be wrapped. -<p> <p>See also <a href="ntqtextedit.html#wordWrap-prop">wordWrap</a>. +<p> <p>See also <a href="tqtextedit.html#wordWrap-prop">wordWrap</a>. -<p>Set this property's value with <a href="ntqtextedit.html#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() and get this property's value with <a href="ntqtextedit.html#wrapColumnOrWidth">wrapColumnOrWidth</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setWrapColumnOrWidth">setWrapColumnOrWidth</a>() and get this property's value with <a href="tqtextedit.html#wrapColumnOrWidth">wrapColumnOrWidth</a>(). - QTextEdit::wrapPolicy - + TQTextEdit::wrapPolicy + <p>This property holds the word wrap policy, at whitespace or anywhere. -<p>Defines where text can be wrapped when word wrap mode is not <a href="ntqtextedit.html#WordWrap-enum">NoWrap</a>. The choices are <a href="ntqtextedit.html#WrapPolicy-enum">AtWordBoundary</a> (the default), <a href="ntqtextedit.html#WrapPolicy-enum">Anywhere</a> and <a href="ntqtextedit.html#WrapPolicy-enum">AtWordOrDocumentBoundary</a> -<p> <p>See also <a href="ntqtextedit.html#wordWrap-prop">wordWrap</a>. +<p>Defines where text can be wrapped when word wrap mode is not <a href="tqtextedit.html#WordWrap-enum">NoWrap</a>. The choices are <a href="tqtextedit.html#WrapPolicy-enum">AtWordBoundary</a> (the default), <a href="tqtextedit.html#WrapPolicy-enum">Anywhere</a> and <a href="tqtextedit.html#WrapPolicy-enum">AtWordOrDocumentBoundary</a> +<p> <p>See also <a href="tqtextedit.html#wordWrap-prop">wordWrap</a>. -<p>Set this property's value with <a href="ntqtextedit.html#setWrapPolicy">setWrapPolicy</a>() and get this property's value with <a href="ntqtextedit.html#wrapPolicy">wrapPolicy</a>(). +<p>Set this property's value with <a href="tqtextedit.html#setWrapPolicy">setWrapPolicy</a>() and get this property's value with <a href="tqtextedit.html#wrapPolicy">wrapPolicy</a>(). diff --git a/doc/html/propertyindex b/doc/html/propertyindex index 48327def..61f8bd7a 100644 --- a/doc/html/propertyindex +++ b/doc/html/propertyindex @@ -314,26 +314,26 @@ "QTable/selectionMode" ntqtable.html#selectionMode-prop "QTable/showGrid" ntqtable.html#showGrid-prop "QTable/sorting" ntqtable.html#sorting-prop -"QTextBrowser/source" ntqtextbrowser.html#source-prop -"QTextEdit/autoFormatting" ntqtextedit.html#autoFormatting-prop -"QTextEdit/documentTitle" ntqtextedit.html#documentTitle-prop -"QTextEdit/hasSelectedText" ntqtextedit.html#hasSelectedText-prop -"QTextEdit/length" ntqtextedit.html#length-prop -"QTextEdit/linkUnderline" ntqtextedit.html#linkUnderline-prop -"QTextEdit/modified" ntqtextedit.html#modified-prop -"QTextEdit/overwriteMode" ntqtextedit.html#overwriteMode-prop -"QTextEdit/paper" ntqtextedit.html#paper-prop -"QTextEdit/readOnly" ntqtextedit.html#readOnly-prop -"QTextEdit/selectedText" ntqtextedit.html#selectedText-prop -"QTextEdit/tabChangesFocus" ntqtextedit.html#tabChangesFocus-prop -"QTextEdit/tabStopWidth" ntqtextedit.html#tabStopWidth-prop -"QTextEdit/text" ntqtextedit.html#text-prop -"QTextEdit/textFormat" ntqtextedit.html#textFormat-prop -"QTextEdit/undoDepth" ntqtextedit.html#undoDepth-prop -"QTextEdit/undoRedoEnabled" ntqtextedit.html#undoRedoEnabled-prop -"QTextEdit/wordWrap" ntqtextedit.html#wordWrap-prop -"QTextEdit/wrapColumnOrWidth" ntqtextedit.html#wrapColumnOrWidth-prop -"QTextEdit/wrapPolicy" ntqtextedit.html#wrapPolicy-prop +"TQTextBrowser/source" tqtextbrowser.html#source-prop +"TQTextEdit/autoFormatting" tqtextedit.html#autoFormatting-prop +"TQTextEdit/documentTitle" tqtextedit.html#documentTitle-prop +"TQTextEdit/hasSelectedText" tqtextedit.html#hasSelectedText-prop +"TQTextEdit/length" tqtextedit.html#length-prop +"TQTextEdit/linkUnderline" tqtextedit.html#linkUnderline-prop +"TQTextEdit/modified" tqtextedit.html#modified-prop +"TQTextEdit/overwriteMode" tqtextedit.html#overwriteMode-prop +"TQTextEdit/paper" tqtextedit.html#paper-prop +"TQTextEdit/readOnly" tqtextedit.html#readOnly-prop +"TQTextEdit/selectedText" tqtextedit.html#selectedText-prop +"TQTextEdit/tabChangesFocus" tqtextedit.html#tabChangesFocus-prop +"TQTextEdit/tabStopWidth" tqtextedit.html#tabStopWidth-prop +"TQTextEdit/text" tqtextedit.html#text-prop +"TQTextEdit/textFormat" tqtextedit.html#textFormat-prop +"TQTextEdit/undoDepth" tqtextedit.html#undoDepth-prop +"TQTextEdit/undoRedoEnabled" tqtextedit.html#undoRedoEnabled-prop +"TQTextEdit/wordWrap" tqtextedit.html#wordWrap-prop +"TQTextEdit/wrapColumnOrWidth" tqtextedit.html#wrapColumnOrWidth-prop +"TQTextEdit/wrapPolicy" tqtextedit.html#wrapPolicy-prop "QTimeEdit/autoAdvance" qtimeedit.html#autoAdvance-prop "QTimeEdit/display" qtimeedit.html#display-prop "QTimeEdit/maxValue" qtimeedit.html#maxValue-prop diff --git a/doc/html/qaction-application-example.html b/doc/html/qaction-application-example.html index 5b441bf4..a04ca8e7 100644 --- a/doc/html/qaction-application-example.html +++ b/doc/html/qaction-application-example.html @@ -82,7 +82,7 @@ private slots: private: TQPrinter *printer; - TQTextEdit *e; + TQTextEdit *e; TQString filename; }; @@ -110,7 +110,7 @@ private: #include <ntqtoolbutton.h> #include <ntqpopupmenu.h> #include <ntqmenubar.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqfile.h> #include <ntqfiledialog.h> #include <ntqstatusbar.h> @@ -118,7 +118,7 @@ private: #include <ntqprinter.h> #include <ntqapplication.h> #include <ntqaccel.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqpainter.h> #include <ntqpaintdevicemetrics.h> #include <ntqwhatsthis.h> @@ -232,7 +232,7 @@ private: // create and define the central widget - e = new TQTextEdit( this, "editor" ); + e = new TQTextEdit( this, "editor" ); e->setFocus(); setCentralWidget( e ); statusBar()->message( "Ready", 2000 ); @@ -271,9 +271,9 @@ void ApplicationWindow::load( const T if ( !f.open( IO_ReadOnly ) ) return; - TQTextStream ts( &f ); - e->setText( ts.read() ); - e->setModified( FALSE ); + TQTextStream ts( &f ); + e->setText( ts.read() ); + e->setModified( FALSE ); setCaption( fileName ); statusBar()->message( "Loaded document " + fileName, 2000 ); } @@ -286,7 +286,7 @@ void ApplicationWindow::save() return; } - TQString text = e->text(); + TQString text = e->text(); TQFile f( filename ); if ( !f.open( IO_WriteOnly ) ) { statusBar()->message( TQString("Could not write to %1").arg(filename), @@ -294,11 +294,11 @@ void ApplicationWindow::save() return; } - TQTextStream t( &f ); + TQTextStream t( &f ); t << text; f.close(); - e->setModified( FALSE ); + e->setModified( FALSE ); setCaption( filename ); @@ -334,11 +334,11 @@ void ApplicationWindow::print() int dpiy = metrics.logicalDpiY(); int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins TQRect view( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin ); - TQSimpleRichText richText( TQStyleSheet::convertFromPlainText(e->text()), + TQSimpleRichText richText( TQStyleSheet::convertFromPlainText(e->text()), TQFont(), - e->context(), - e->styleSheet(), - e->mimeSourceFactory(), + e->context(), + e->styleSheet(), + e->mimeSourceFactory(), view.height() ); richText.setWidth( &p, view.width() ); int page = 1; @@ -362,7 +362,7 @@ void ApplicationWindow::print() void ApplicationWindow::closeEvent( TQCloseEvent* ce ) { - if ( !e->isModified() ) { + if ( !e->isModified() ) { ce->accept(); return; } diff --git a/doc/html/qaxbase.html b/doc/html/qaxbase.html index 5f49323d..a78a0cc6 100644 --- a/doc/html/qaxbase.html +++ b/doc/html/qaxbase.html @@ -420,7 +420,7 @@ the help file, and the help context ID in brackets, e.g. "filename [id]".

    Returns a rich text string with documentation for the wrapped COM object. Dump the string to an HTML-file, -or use it in e.g. a TQTextBrowser widget. +or use it in e.g. a TQTextBrowser widget.

    bool TQAxBase::initialize ( IUnknown ** ptr ) [virtual protected]

    diff --git a/doc/html/qbig5codec-h.html b/doc/html/qbig5codec-h.html index 1ca433ad..445e6ca4 100644 --- a/doc/html/qbig5codec-h.html +++ b/doc/html/qbig5codec-h.html @@ -82,7 +82,7 @@ body { background: #ffffff; color: black; } #define TQBIG5CODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_BIG_CODECS diff --git a/doc/html/qbig5codec-members.html b/doc/html/qbig5codec-members.html index bc3c72ec..1fad0d9f 100644 --- a/doc/html/qbig5codec-members.html +++ b/doc/html/qbig5codec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQBig5Codec, including inherited members.


    diff --git a/doc/html/qbig5hkscscodec-members.html b/doc/html/qbig5hkscscodec-members.html index 5ee1a4b5..bf81269d 100644 --- a/doc/html/qbig5hkscscodec-members.html +++ b/doc/html/qbig5hkscscodec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQBig5hkscsCodec, including inherited members.


    diff --git a/doc/html/qbig5hkscscodec.html b/doc/html/qbig5hkscscodec.html index 7eda79ff..6a6a018c 100644 --- a/doc/html/qbig5hkscscodec.html +++ b/doc/html/qbig5hkscscodec.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

    The TQBig5hkscsCodec class provides conversion to and from the Big5-HKSCS encoding. More...

    #include <ntqbig5codec.h> -

    Inherits TQTextCodec. +

    Inherits TQTextCodec.

    List of all member functions.


    Detailed Description

    diff --git a/doc/html/qdir-example.html b/doc/html/qdir-example.html index b540a69a..ffd1d77f 100644 --- a/doc/html/qdir-example.html +++ b/doc/html/qdir-example.html @@ -49,10 +49,10 @@ body { background: #ffffff; color: black; } #include "ntqdir.h" #include <ntqapplication.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqfileinfo.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqhbox.h> #include <ntqspinbox.h> #include <ntqlabel.h> @@ -64,7 +64,7 @@ body { background: #ffffff; color: black; } #include <ntqpushbutton.h> #include <ntqtoolbutton.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqtooltip.h> #include <stdlib.h> @@ -147,8 +147,8 @@ void PixmapView::setPixmap( const TQ : TQWidgetStack( parent ) { normalText = new TQMultiLineEdit( this ); - normalText->setReadOnly( TRUE ); - html = new TQTextView( this ); + normalText->setReadOnly( TRUE ); + html = new TQTextView( this ); pixmap = new PixmapView( this ); raiseWidget( normalText ); } @@ -159,7 +159,7 @@ void Preview::showPreview( const TQUrl< TQString path = u.path(); TQFileInfo fi( path ); if ( fi.isFile() && (int)fi.size() > size * 1000 ) { - normalText->setText( tr( "The File\n%1\nis too large, so I don't show it!" ).arg( path ) ); + normalText->setText( tr( "The File\n%1\nis too large, so I don't show it!" ).arg( path ) ); raiseWidget( normalText ); return; } @@ -169,29 +169,29 @@ void Preview::showPreview( const TQUrl< if ( fi.isFile() ) { TQFile f( path ); if ( f.open( IO_ReadOnly ) ) { - TQTextStream ts( &f ); - TQString text = ts.read(); + TQTextStream ts( &f ); + TQString text = ts.read(); f.close(); if ( fi.extension().lower().contains( "htm" ) ) { - TQString url = html->mimeSourceFactory()->makeAbsolute( path, html->context() ); - html->setText( text, url ); + TQString url = html->mimeSourceFactory()->makeAbsolute( path, html->context() ); + html->setText( text, url ); raiseWidget( html ); return; } else { - normalText->setText( text ); + normalText->setText( text ); raiseWidget( normalText ); return; } } } - normalText->setText( TQString::null ); + normalText->setText( TQString::null ); raiseWidget( normalText ); } else { pixmap->setPixmap( pix ); raiseWidget( pixmap ); } } else { - normalText->setText( "I only show local files!" ); + normalText->setText( "I only show local files!" ); raiseWidget( normalText ); } } diff --git a/doc/html/qdockarea-h.html b/doc/html/qdockarea-h.html index 65517055..988d0b4c 100644 --- a/doc/html/qdockarea-h.html +++ b/doc/html/qdockarea-h.html @@ -84,7 +84,7 @@ body { background: #ffffff; color: black; } #include "ntqlayout.h" #include "tqvaluelist.h" #include "ntqguardedptr.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #endif // QT_H #ifndef TQT_NO_MAINWINDOW diff --git a/doc/html/qdropevent.html b/doc/html/qdropevent.html index a53c6591..5c444ce0 100644 --- a/doc/html/qdropevent.html +++ b/doc/html/qdropevent.html @@ -105,7 +105,7 @@ which your widget processed. Set y to TRUE (the default) if your widget could process the data, otherwise set y to FALSE. To get the data, use encodedData(), or preferably, the decode() methods of existing TQDragObject subclasses, such as -TQTextDrag::decode(), or your own subclasses. +TQTextDrag::decode(), or your own subclasses.

    See also acceptAction().

    Example: iconview/simple_dd/main.cpp. diff --git a/doc/html/qeucjpcodec-h.html b/doc/html/qeucjpcodec-h.html index 8c28e898..2767442f 100644 --- a/doc/html/qeucjpcodec-h.html +++ b/doc/html/qeucjpcodec-h.html @@ -107,7 +107,7 @@ body { background: #ffffff; color: black; } #define TQEUCJPCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqjpunicode.h" #endif // QT_H diff --git a/doc/html/qeucjpcodec-members.html b/doc/html/qeucjpcodec-members.html index d56a5ada..0bdb369e 100644 --- a/doc/html/qeucjpcodec-members.html +++ b/doc/html/qeucjpcodec-members.html @@ -37,31 +37,31 @@ body { background: #ffffff; color: black; }


    diff --git a/doc/html/qeuckrcodec-h.html b/doc/html/qeuckrcodec-h.html index 0446d1a5..77900aca 100644 --- a/doc/html/qeuckrcodec-h.html +++ b/doc/html/qeuckrcodec-h.html @@ -103,7 +103,7 @@ body { background: #ffffff; color: black; } #define TQEUCKRCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_BIG_CODECS diff --git a/doc/html/qeuckrcodec-members.html b/doc/html/qeuckrcodec-members.html index 52ac2111..3ad209ea 100644 --- a/doc/html/qeuckrcodec-members.html +++ b/doc/html/qeuckrcodec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQEucKrCodec, including inherited members.


    diff --git a/doc/html/qfontmanager_qws-h.html b/doc/html/qfontmanager_qws-h.html index 40f47881..137a3d9b 100644 --- a/doc/html/qfontmanager_qws-h.html +++ b/doc/html/qfontmanager_qws-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #ifndef QT_H #include "ntqfont.h" #include "tqptrlist.h" -#include <private/qtextengine_p.h> +#include <private/tqtextengine_p.h> #endif // QT_H // These are stored in the shared memory segment in front of their diff --git a/doc/html/qgb18030codec-h.html b/doc/html/qgb18030codec-h.html index 66305563..84781ea9 100644 --- a/doc/html/qgb18030codec-h.html +++ b/doc/html/qgb18030codec-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQGB18030CODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H diff --git a/doc/html/qgb18030codec-members.html b/doc/html/qgb18030codec-members.html index 040e8cbf..39cbfc6c 100644 --- a/doc/html/qgb18030codec-members.html +++ b/doc/html/qgb18030codec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQGb18030Codec, including inherited members.


    diff --git a/doc/html/qgb2312codec-members.html b/doc/html/qgb2312codec-members.html index dbc8dcc9..02b9b867 100644 --- a/doc/html/qgb2312codec-members.html +++ b/doc/html/qgb2312codec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQGb2312Codec, including inherited members.


    diff --git a/doc/html/qgbkcodec-members.html b/doc/html/qgbkcodec-members.html index e8fd8b87..15c7a000 100644 --- a/doc/html/qgbkcodec-members.html +++ b/doc/html/qgbkcodec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQGbkCodec, including inherited members.


    diff --git a/doc/html/qgfx_qws-h.html b/doc/html/qgfx_qws-h.html index 5f8d2497..3fb69e87 100644 --- a/doc/html/qgfx_qws-h.html +++ b/doc/html/qgfx_qws-h.html @@ -84,7 +84,7 @@ body { background: #ffffff; color: black; } #include "ntqpoint.h" #endif // QT_H -#include <private/qtextengine_p.h> +#include <private/tqtextengine_p.h> class TQScreenCursor; diff --git a/doc/html/qhebrewcodec-members.html b/doc/html/qhebrewcodec-members.html index 1460f775..ea578ccd 100644 --- a/doc/html/qhebrewcodec-members.html +++ b/doc/html/qhebrewcodec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQHebrewCodec, including inherited members.


    diff --git a/doc/html/qhebrewcodec.html b/doc/html/qhebrewcodec.html index 29e92170..6430f491 100644 --- a/doc/html/qhebrewcodec.html +++ b/doc/html/qhebrewcodec.html @@ -36,7 +36,7 @@ visually ordered Hebrew. More...

    All the functions in this class are reentrant when TQt is built with thread support.

    #include <ntqrtlcodec.h> -

    Inherits TQTextCodec. +

    Inherits TQTextCodec.

    List of all member functions.

    Public Members


    diff --git a/doc/html/qnamespace-h.html b/doc/html/qnamespace-h.html index 2b5c0a70..b70c5e70 100644 --- a/doc/html/qnamespace-h.html +++ b/doc/html/qnamespace-h.html @@ -843,7 +843,7 @@ public: LogText }; - // Documented in qtextedit.cpp + // Documented in tqtextedit.cpp enum AnchorAttribute { AnchorName, AnchorHref diff --git a/doc/html/qnpstream.html b/doc/html/qnpstream.html index 66f62417..223084af 100644 --- a/doc/html/qnpstream.html +++ b/doc/html/qnpstream.html @@ -57,7 +57,7 @@ body { background: #ffffff; color: black; } The TQNPStream class provides a stream of data provided to a TQNPInstance by the browser.

    -

    Note that this is neither a TQTextStream nor a TQDataStream. +

    Note that this is neither a TQTextStream nor a TQDataStream.

    See also TQNPInstance::write() and TQNPInstance::newStreamCreated().


    Member Function Documentation

    diff --git a/doc/html/qrtlcodec-h.html b/doc/html/qrtlcodec-h.html index bdfc830c..f02ea460 100644 --- a/doc/html/qrtlcodec-h.html +++ b/doc/html/qrtlcodec-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQRTLCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_CODEC_HEBREW diff --git a/doc/html/qsjiscodec-h.html b/doc/html/qsjiscodec-h.html index e0f3789f..974c5d4d 100644 --- a/doc/html/qsjiscodec-h.html +++ b/doc/html/qsjiscodec-h.html @@ -107,7 +107,7 @@ body { background: #ffffff; color: black; } #define TQSJISCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqjpunicode.h" #endif // QT_H diff --git a/doc/html/qsjiscodec-members.html b/doc/html/qsjiscodec-members.html index ff9d65cc..340a680b 100644 --- a/doc/html/qsjiscodec-members.html +++ b/doc/html/qsjiscodec-members.html @@ -37,31 +37,31 @@ body { background: #ffffff; color: black; }


    diff --git a/doc/html/qt-template-lib.html b/doc/html/qt-template-lib.html index 3f3c4c83..a695db8b 100644 --- a/doc/html/qt-template-lib.html +++ b/doc/html/qt-template-lib.html @@ -239,7 +239,7 @@ OutputIterator, in this case a TQTextOStreamIterator: list.push_back( 100 ); list.push_back( 200 ); list.push_back( 300 ); - TQTextOStream str( stdout ); + TQTextOStream str( stdout ); tqCopy( list.begin(), list.end(), TQTextOStreamIterator(str) );
  • @@ -287,7 +287,7 @@ as possible. In the above example, you could just as easily print out a standard C++ array with tqCopy():

         int arr[] = { 100, 200, 300 };
    -    TQTextOStream str( stdout );
    +    TQTextOStream str( stdout );
         tqCopy( arr, arr + 3, TQTextOStreamIterator( str ) ); 
     
    diff --git a/doc/html/qt.dcf b/doc/html/qt.dcf index 9c187608..8d3c0187 100644 --- a/doc/html/qt.dcf +++ b/doc/html/qt.dcf @@ -7888,302 +7888,302 @@
    -
    - QTextBrowser - anchorClicked - backward - backwardAvailable - forward - forwardAvailable - highlighted - home - keyPressEvent - linkClicked - modified - overwriteMode - readOnly - reload - setSource - setText - source - source - sourceChanged - undoDepth - undoRedoEnabled -
    -
    -
    -
    - QTextCodec - canEncode - codecForCStrings - codecForContent - codecForIndex - codecForLocale - codecForMib - codecForName - codecForTr - deleteAllCodecs - fromUnicode - heuristicContentMatch - heuristicNameMatch - loadCharmap - loadCharmapFile - locale - makeDecoder - makeEncoder - mibEnum - mimeName - name - setCodecForCStrings - setCodecForLocale - setCodecForTr - simpleHeuristicNameMatch - toUnicode - ~QTextCodec -
    -
    -
    -
    - QTextCodecPlugin - createForMib - createForName - mibEnums - names - ~QTextCodecPlugin -
    -
    -
    -
    - QTextDecoder - toUnicode - ~QTextDecoder -
    -
    -
    -
    - QTextDrag - canDecode - decode - setSubtype - setText - ~QTextDrag -
    +
    + TQTextBrowser + anchorClicked + backward + backwardAvailable + forward + forwardAvailable + highlighted + home + keyPressEvent + linkClicked + modified + overwriteMode + readOnly + reload + setSource + setText + source + source + sourceChanged + undoDepth + undoRedoEnabled +
    +
    +
    +
    + TQTextCodec + canEncode + codecForCStrings + codecForContent + codecForIndex + codecForLocale + codecForMib + codecForName + codecForTr + deleteAllCodecs + fromUnicode + heuristicContentMatch + heuristicNameMatch + loadCharmap + loadCharmapFile + locale + makeDecoder + makeEncoder + mibEnum + mimeName + name + setCodecForCStrings + setCodecForLocale + setCodecForTr + simpleHeuristicNameMatch + toUnicode + ~TQTextCodec +
    +
    +
    +
    + TQTextCodecPlugin + createForMib + createForName + mibEnums + names + ~TQTextCodecPlugin +
    +
    +
    +
    + TQTextDecoder + toUnicode + ~TQTextDecoder +
    +
    +
    +
    + TQTextDrag + canDecode + decode + setSubtype + setText + ~TQTextDrag +
    -
    - QTextEdit - AutoFormatting - CursorAction - KeyboardAction - VerticalAlignment - WordWrap - WrapPolicy - alignment - anchorAt - append - autoFormatting - autoFormatting - bold - charAt - clear - clearParagraphBackground - clicked - color - context - copy - copyAvailable - createPopupMenu - currentAlignmentChanged - currentColorChanged - currentFont - currentFontChanged - currentVerticalAlignmentChanged - cursorPositionChanged - cut - del - doKeyboardAction - documentTitle - documentTitle - doubleClicked - ensureCursorVisible - family - find - focusNextPrevChild - getCursorPosition - getSelection - hasSelectedText - hasSelectedText - heightForWidth - insert - insertAt - insertParagraph - isModified - isOverwriteMode - isReadOnly - isRedoAvailable - isUndoAvailable - isUndoRedoEnabled - italic - keyPressEvent - length - length - lineOfChar - lines - linesOfParagraph - linkUnderline - linkUnderline - maxLogLines - mimeSourceFactory - modificationChanged - modified - moveCursor - optimCheckLimit - overwriteMode - paper - paper - paragraphAt - paragraphBackgroundColor - paragraphLength - paragraphRect - paragraphs - paste - pasteSpecial - pasteSubType - placeCursor - pointSize - readOnly - redo - redoAvailable - removeParagraph - removeSelectedText - removeSelection - repaintChanged - returnPressed - scrollToAnchor - scrollToBottom - selectAll - selectedText - selectedText - selectionChanged - setAlignment - setAutoFormatting - setBold - setColor - setCurrentFont - setCursorPosition - setFamily - setItalic - setLinkUnderline - setMaxLogLines - setMimeSourceFactory - setModified - setOverwriteMode - setPaper - setParagraphBackgroundColor - setPointSize - setReadOnly - setSelection - setSelectionAttributes - setStyleSheet - setTabChangesFocus - setTabStopWidth - setText - setTextFormat - setUnderline - setUndoDepth - setUndoRedoEnabled - setVerticalAlignment - setWordWrap - setWrapColumnOrWidth - setWrapPolicy - styleSheet - sync - syntaxHighlighter - tabChangesFocus - tabChangesFocus - tabStopWidth - tabStopWidth - text - text - textChanged - textCursor - textFormat - textFormat - underline - undo - undoAvailable - undoDepth - undoDepth - undoRedoEnabled - wordWrap - wordWrap - wrapColumnOrWidth - wrapColumnOrWidth - wrapPolicy - wrapPolicy - zoomIn - zoomOut - zoomTo -
    -
    -
    -
    - QTextEncoder - fromUnicode - ~QTextEncoder -
    -
    -
    -
    - QTextIStream -
    -
    -
    -
    - QTextOStream -
    -
    -
    -
    - QTextStream - Encoding - atEnd - codec - device - fill - flags - operator<< - operator>> - precision - read - readLine - readRawBytes - reset - setCodec - setDevice - setEncoding - setf - skipWhiteSpace - ts_getbuf - ts_getline - ts_putc - unsetDevice - unsetf - width - writeRawBytes - ~QTextStream -
    -
    -
    -
    - modified - overwriteMode - readOnly - undoDepth - undoRedoEnabled -
    -
    +
    + TQTextEdit + AutoFormatting + CursorAction + KeyboardAction + VerticalAlignment + WordWrap + WrapPolicy + alignment + anchorAt + append + autoFormatting + autoFormatting + bold + charAt + clear + clearParagraphBackground + clicked + color + context + copy + copyAvailable + createPopupMenu + currentAlignmentChanged + currentColorChanged + currentFont + currentFontChanged + currentVerticalAlignmentChanged + cursorPositionChanged + cut + del + doKeyboardAction + documentTitle + documentTitle + doubleClicked + ensureCursorVisible + family + find + focusNextPrevChild + getCursorPosition + getSelection + hasSelectedText + hasSelectedText + heightForWidth + insert + insertAt + insertParagraph + isModified + isOverwriteMode + isReadOnly + isRedoAvailable + isUndoAvailable + isUndoRedoEnabled + italic + keyPressEvent + length + length + lineOfChar + lines + linesOfParagraph + linkUnderline + linkUnderline + maxLogLines + mimeSourceFactory + modificationChanged + modified + moveCursor + optimCheckLimit + overwriteMode + paper + paper + paragraphAt + paragraphBackgroundColor + paragraphLength + paragraphRect + paragraphs + paste + pasteSpecial + pasteSubType + placeCursor + pointSize + readOnly + redo + redoAvailable + removeParagraph + removeSelectedText + removeSelection + repaintChanged + returnPressed + scrollToAnchor + scrollToBottom + selectAll + selectedText + selectedText + selectionChanged + setAlignment + setAutoFormatting + setBold + setColor + setCurrentFont + setCursorPosition + setFamily + setItalic + setLinkUnderline + setMaxLogLines + setMimeSourceFactory + setModified + setOverwriteMode + setPaper + setParagraphBackgroundColor + setPointSize + setReadOnly + setSelection + setSelectionAttributes + setStyleSheet + setTabChangesFocus + setTabStopWidth + setText + setTextFormat + setUnderline + setUndoDepth + setUndoRedoEnabled + setVerticalAlignment + setWordWrap + setWrapColumnOrWidth + setWrapPolicy + styleSheet + sync + syntaxHighlighter + tabChangesFocus + tabChangesFocus + tabStopWidth + tabStopWidth + text + text + textChanged + textCursor + textFormat + textFormat + underline + undo + undoAvailable + undoDepth + undoDepth + undoRedoEnabled + wordWrap + wordWrap + wrapColumnOrWidth + wrapColumnOrWidth + wrapPolicy + wrapPolicy + zoomIn + zoomOut + zoomTo +
    +
    +
    +
    + TQTextEncoder + fromUnicode + ~TQTextEncoder +
    +
    +
    +
    + TQTextIStream +
    +
    +
    +
    + TQTextOStream +
    +
    +
    +
    + TQTextStream + Encoding + atEnd + codec + device + fill + flags + operator<< + operator>> + precision + read + readLine + readRawBytes + reset + setCodec + setDevice + setEncoding + setf + skipWhiteSpace + ts_getbuf + ts_getline + ts_putc + unsetDevice + unsetf + width + writeRawBytes + ~TQTextStream +
    +
    +
    +
    + modified + overwriteMode + readOnly + undoDepth + undoRedoEnabled +
    +
    QThread diff --git a/doc/html/qtextbrowser-h.html b/doc/html/qtextbrowser-h.html deleted file mode 100644 index 0932d283..00000000 --- a/doc/html/qtextbrowser-h.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - -ntqtextbrowser.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqtextbrowser.h

    - -

    This is the verbatim text of the ntqtextbrowser.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqtextbrowser.h   3.3.8   edited Jan 11 14:39 $
    -**
    -** Definition of the TQTextBrowser class
    -**
    -** Created : 990101
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the widgets module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQTEXTBROWSER_H
    -#define TQTEXTBROWSER_H
    -
    -#ifndef QT_H
    -#include "tqptrlist.h"
    -#include "ntqpixmap.h"
    -#include "ntqcolor.h"
    -#include "ntqtextedit.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_TEXTBROWSER
    -
    -class TQTextBrowserData;
    -
    -class TQ_EXPORT TQTextBrowser : public TQTextEdit
    -{
    -    TQ_OBJECT
    -    TQ_PROPERTY( TQString source READ source WRITE setSource )
    -    TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false )
    -    TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false )
    -    TQ_OVERRIDE( bool modified SCRIPTABLE false)
    -    TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false )
    -    TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false )
    -
    -public:
    -    TQTextBrowser( TQWidget* parent=0, const char* name=0 );
    -    ~TQTextBrowser();
    -
    -    TQString source() const;
    -
    -public slots:
    -    virtual void setSource(const TQString& name);
    -    virtual void backward();
    -    virtual void forward();
    -    virtual void home();
    -    virtual void reload();
    -    void setText( const TQString &txt ) { setText( txt, TQString::null ); }
    -    virtual void setText( const TQString &txt, const TQString &context );
    -
    -signals:
    -    void backwardAvailable( bool );
    -    void forwardAvailable( bool );
    -    void sourceChanged( const TQString& );
    -    void highlighted( const TQString& );
    -    void linkClicked( const TQString& );
    -    void anchorClicked( const TQString&, const TQString& );
    -
    -protected:
    -    void keyPressEvent( TQKeyEvent * e);
    -
    -private:
    -    void popupDetail( const TQString& contents, const TQPoint& pos );
    -    bool linksEnabled() const { return TRUE; }
    -    void emitHighlighted( const TQString &s );
    -    void emitLinkClicked( const TQString &s );
    -    TQTextBrowserData *d;
    -
    -private:	// Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQTextBrowser( const TQTextBrowser & );
    -    TQTextBrowser& operator=( const TQTextBrowser & );
    -#endif
    -};
    -
    -#endif // TQT_NO_TEXTBROWSER
    -
    -#endif // TQTEXTBROWSER_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextbrowser-m.png b/doc/html/qtextbrowser-m.png deleted file mode 100644 index 39c1bdb7..00000000 Binary files a/doc/html/qtextbrowser-m.png and /dev/null differ diff --git a/doc/html/qtextbrowser-members.html b/doc/html/qtextbrowser-members.html deleted file mode 100644 index d24648ca..00000000 --- a/doc/html/qtextbrowser-members.html +++ /dev/null @@ -1,556 +0,0 @@ - - - - - -TQTextBrowser Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextBrowser

    - -

    This is the complete list of member functions for -TQTextBrowser, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextbrowser-w.png b/doc/html/qtextbrowser-w.png deleted file mode 100644 index 84343370..00000000 Binary files a/doc/html/qtextbrowser-w.png and /dev/null differ diff --git a/doc/html/qtextcodec-h.html b/doc/html/qtextcodec-h.html deleted file mode 100644 index 9b6fcdc6..00000000 --- a/doc/html/qtextcodec-h.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - -ntqtextcodec.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqtextcodec.h

    - -

    This is the verbatim text of the ntqtextcodec.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqtextcodec.h   3.3.8   edited Jan 11 14:46 $
    -**
    -** Definition of TQTextCodec class
    -**
    -** Created : 981015
    -**
    -** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the tools module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQTEXTCODEC_H
    -#define TQTEXTCODEC_H
    -
    -#ifndef QT_H
    -#include "tqstring.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_TEXTCODEC
    -
    -class TQTextCodec;
    -class TQIODevice;
    -class TQFont;
    -
    -class TQ_EXPORT TQTextEncoder {
    -public:
    -    virtual ~TQTextEncoder();
    -    virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) = 0;
    -};
    -
    -class TQ_EXPORT TQTextDecoder {
    -public:
    -    virtual ~TQTextDecoder();
    -    virtual TQString toUnicode(const char* chars, int len) = 0;
    -};
    -
    -class TQ_EXPORT TQTextCodec {
    -public:
    -    virtual ~TQTextCodec();
    -
    -#ifndef TQT_NO_CODECS
    -    static TQTextCodec* loadCharmap(TQIODevice*);
    -    static TQTextCodec* loadCharmapFile(TQString filename);
    -#endif //TQT_NO_CODECS
    -    static TQTextCodec* codecForMib(int mib);
    -    static TQTextCodec* codecForName(const char* hint, int accuracy=0);
    -    static TQTextCodec* codecForContent(const char* chars, int len);
    -    static TQTextCodec* codecForIndex(int i);
    -    static TQTextCodec* codecForLocale();
    -    static void setCodecForLocale(TQTextCodec *c);
    -
    -    static TQTextCodec* codecForTr();
    -    static void setCodecForTr(TQTextCodec *c);
    -    static TQTextCodec* codecForCStrings();
    -    static void setCodecForCStrings(TQTextCodec *c);
    -
    -    static void deleteAllCodecs();
    -
    -    static const char* locale();
    -
    -    virtual const char* name() const = 0;
    -    virtual const char* mimeName() const;
    -    virtual int mibEnum() const = 0;
    -
    -    virtual TQTextDecoder* makeDecoder() const;
    -    virtual TQTextEncoder* makeEncoder() const;
    -
    -    virtual TQString toUnicode(const char* chars, int len) const;
    -    virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) const;
    -
    -    TQCString fromUnicode(const TQString& uc) const;
    -    TQString toUnicode(const TQByteArray&, int len) const;
    -    TQString toUnicode(const TQByteArray&) const;
    -    TQString toUnicode(const TQCString&, int len) const;
    -    TQString toUnicode(const TQCString&) const;
    -    TQString toUnicode(const char* chars) const;
    -    virtual bool canEncode( TQChar ) const;
    -    virtual bool canEncode( const TQString& ) const;
    -
    -    virtual int heuristicContentMatch(const char* chars, int len) const = 0;
    -    virtual int heuristicNameMatch(const char* hint) const;
    -
    -    virtual TQByteArray fromUnicode(const TQString& uc, int from, int len) const;
    -    virtual unsigned short characterFromUnicode(const TQString &str, int pos) const;
    -
    -protected:
    -    TQTextCodec();
    -    static int simpleHeuristicNameMatch(const char* name, const char* hint);
    -
    -private:
    -    friend class TQFont;
    -    friend class TQFontEngineXLFD;
    -    void fromUnicodeInternal( const TQChar *in, unsigned short *out,  int length );
    -
    -    static TQTextCodec *cftr;
    -    static TQTextCodec *cfcs;
    -};
    -
    -inline TQTextCodec* TQTextCodec::codecForTr() { return cftr; }
    -inline void TQTextCodec::setCodecForTr(TQTextCodec *c) { cftr = c; }
    -inline TQTextCodec* TQTextCodec::codecForCStrings() { return cfcs; }
    -inline void TQTextCodec::setCodecForCStrings(TQTextCodec *c) { cfcs = c; }
    -
    -#endif // TQT_NO_TEXTCODEC
    -#endif // TQTEXTCODEC_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextcodec-members.html b/doc/html/qtextcodec-members.html deleted file mode 100644 index 1ef38ff5..00000000 --- a/doc/html/qtextcodec-members.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -TQTextCodec Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextCodec

    - -

    This is the complete list of member functions for -TQTextCodec, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextcodecplugin-h.html b/doc/html/qtextcodecplugin-h.html deleted file mode 100644 index 3f40b0dc..00000000 --- a/doc/html/qtextcodecplugin-h.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -ntqtextcodecplugin.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqtextcodecplugin.h

    - -

    This is the verbatim text of the ntqtextcodecplugin.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqtextcodecplugin.h   3.3.8   edited Jan 11 14:46 $
    -**
    -** Definition of TQTextCodecPlugin class
    -**
    -** Created : 010920
    -**
    -** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the tools module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQTEXTCODECPLUGIN_H
    -#define TQTEXTCODECPLUGIN_H
    -
    -#ifndef QT_H
    -#include "ntqgplugin.h"
    -#include "tqstringlist.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_TEXTCODECPLUGIN
    -class TQTextCodec;
    -class TQTextCodecPluginPrivate;
    -
    -class TQ_EXPORT TQTextCodecPlugin : public TQGPlugin
    -{
    -    TQ_OBJECT
    -public:
    -    TQTextCodecPlugin();
    -    ~TQTextCodecPlugin();
    -
    -    virtual TQStringList names() const = 0;
    -    virtual TQTextCodec *createForName( const TQString &name ) = 0;
    -    
    -    virtual TQValueList<int> mibEnums() const = 0;
    -    virtual TQTextCodec *createForMib( int mib ) = 0;
    -
    -private:
    -    TQTextCodecPluginPrivate *d;
    -};
    -#endif // TQT_NO_TEXTCODECPLUGIN
    -#endif // TQTEXTCODECPLUGIN_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextcodecplugin-members.html b/doc/html/qtextcodecplugin-members.html deleted file mode 100644 index 6196bfc1..00000000 --- a/doc/html/qtextcodecplugin-members.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - -TQTextCodecPlugin Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextCodecPlugin

    - -

    This is the complete list of member functions for -TQTextCodecPlugin, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextdecoder-members.html b/doc/html/qtextdecoder-members.html deleted file mode 100644 index ac2e7420..00000000 --- a/doc/html/qtextdecoder-members.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - -TQTextDecoder Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextDecoder

    - -

    This is the complete list of member functions for -TQTextDecoder, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextdecoder.html b/doc/html/qtextdecoder.html deleted file mode 100644 index 880e4029..00000000 --- a/doc/html/qtextdecoder.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - -TQTextDecoder Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextDecoder Class Reference

    - -

    The TQTextDecoder class provides a state-based decoder. -More... -

    All the functions in this class are reentrant when TQt is built with thread support.

    -

    #include <ntqtextcodec.h> -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQTextDecoder class provides a state-based decoder. - - -

    The decoder converts a text format into Unicode, remembering any -state that is required between calls. -

    See also TQTextCodec::makeEncoder() and Internationalization with TQt. - -


    Member Function Documentation

    -

    TQTextDecoder::~TQTextDecoder () [virtual] -

    -Destroys the decoder. - -

    TQString TQTextDecoder::toUnicode ( const char * chars, int len ) [pure virtual] -

    - -

    Converts the first len bytes in chars to Unicode, returning -the result. -

    If not all characters are used (e.g. if only part of a multi-byte -encoding is at the end of the characters), the decoder remembers -enough state to continue with the next call to this function. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextdrag-members.html b/doc/html/qtextdrag-members.html deleted file mode 100644 index a4b16185..00000000 --- a/doc/html/qtextdrag-members.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -TQTextDrag Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextDrag

    - -

    This is the complete list of member functions for -TQTextDrag, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextdrag.html b/doc/html/qtextdrag.html deleted file mode 100644 index 50ac6975..00000000 --- a/doc/html/qtextdrag.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - -TQTextDrag Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextDrag Class Reference

    - -

    The TQTextDrag class is a drag and drop object for -transferring plain and Unicode text. -More... -

    #include <ntqdragobject.h> -

    Inherits TQDragObject. -

    List of all member functions. -

    Public Members

    -
      -
    • TQTextDrag ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 )
    • -
    • TQTextDrag ( TQWidget * dragSource = 0, const char * name = 0 )
    • -
    • ~TQTextDrag ()
    • -
    • virtual void setText ( const TQString & text )
    • -
    • virtual void setSubtype ( const TQCString & st )
    • -
    -

    Static Public Members

    -
      -
    • bool canDecode ( const TQMimeSource * e )
    • -
    • bool decode ( const TQMimeSource * e, TQString & str )
    • -
    • bool decode ( const TQMimeSource * e, TQString & str, TQCString & subtype )
    • -
    -

    Detailed Description

    - - -

    The TQTextDrag class is a drag and drop object for -transferring plain and Unicode text. -

    -

    Plain text is passed in a TQString which may contain multiple lines -(i.e. may contain newline characters). The drag target will receive -the newlines according to the runtime environment, e.g. LF on Unix, -and CRLF on Windows. -

    TQt provides no built-in mechanism for delivering only a single-line. -

    For more information about drag and drop, see the TQDragObject class -and the drag and drop documentation. -

    See also Drag And Drop Classes. - -


    Member Function Documentation

    -

    TQTextDrag::TQTextDrag ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 ) -

    -Constructs a text drag object and sets its data to text. dragSource must be the drag source; name is the object name. - -

    TQTextDrag::TQTextDrag ( TQWidget * dragSource = 0, const char * name = 0 ) -

    -Constructs a default text drag object. dragSource must be the -drag source; name is the object name. - -

    TQTextDrag::~TQTextDrag () -

    -Destroys the text drag object and frees up all allocated -resources. - -

    bool TQTextDrag::canDecode ( const TQMimeSource * e ) [static] -

    -Returns TRUE if the information in e can be decoded into a -TQString; otherwise returns FALSE. -

    See also decode(). - -

    Example: iconview/simple_dd/main.cpp. -

    bool TQTextDrag::decode ( const TQMimeSource * e, TQString & str ) [static] -

    -Attempts to decode the dropped information in e into str. -Returns TRUE if successful; otherwise returns FALSE. -

    See also canDecode(). - -

    Example: iconview/simple_dd/main.cpp. -

    bool TQTextDrag::decode ( const TQMimeSource * e, TQString & str, TQCString & subtype ) [static] -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Attempts to decode the dropped information in e into str. -Returns TRUE if successful; otherwise returns FALSE. If subtype -is null, any text subtype is accepted; otherwise only the -specified subtype is accepted. -

    See also canDecode(). - -

    void TQTextDrag::setSubtype ( const TQCString & st ) [virtual] -

    -Sets the MIME subtype of the text being dragged to st. The -default subtype is "plain", so the default MIME type of the text -is "text/plain". You might use this to declare that the text is -"text/html" by calling setSubtype("html"). - -

    void TQTextDrag::setText ( const TQString & text ) [virtual] -

    -Sets the text to be dragged to text. You will need to call this -if you did not pass the text during construction. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextedit-h.html b/doc/html/qtextedit-h.html deleted file mode 100644 index c0374780..00000000 --- a/doc/html/qtextedit-h.html +++ /dev/null @@ -1,655 +0,0 @@ - - - - - -ntqtextedit.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqtextedit.h

    - -

    This is the verbatim text of the ntqtextedit.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqtextedit.h   3.3.8   edited Jan 11 14:39 $
    -**
    -** Definition of the TQTextEdit class
    -**
    -** Created : 990101
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the widgets module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQTEXTEDIT_H
    -#define TQTEXTEDIT_H
    -
    -#ifndef QT_H
    -#include "ntqscrollview.h"
    -#include "ntqstylesheet.h"
    -#include "tqptrvector.h"
    -#include "tqvaluelist.h"
    -#include "tqptrlist.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_TEXTEDIT
    -// uncomment below to enable optimization mode - also uncomment the
    -// optimDoAutoScroll() private slot since moc ignores #ifdefs..
    -#define QT_TEXTEDIT_OPTIMIZATION
    -
    -class TQPainter;
    -class TQTextDocument;
    -class TQTextCursor;
    -class TQKeyEvent;
    -class TQResizeEvent;
    -class TQMouseEvent;
    -class TQTimer;
    -class TQTextString;
    -class TQTextCommand;
    -class TQTextParagraph;
    -class TQTextFormat;
    -class TQFont;
    -class TQColor;
    -class TQTextEdit;
    -class TQTextBrowser;
    -class TQTextString;
    -struct TQUndoRedoInfoPrivate;
    -class TQPopupMenu;
    -class TQTextEditPrivate;
    -class TQSyntaxHighlighter;
    -
    -#ifdef QT_TEXTEDIT_OPTIMIZATION
    -class TQTextEditOptimPrivate
    -{
    -public:
    -    // Note: no left-tag has any value for leftTag or parent, and
    -    // no right-tag has any formatting flags set.
    -    enum TagType { Color = 0, Format = 1 };
    -    struct Tag {
    -	TagType type:2;
    -	bool bold:1;
    -	bool italic:1;
    -	bool underline:1;
    -	int line;
    -	int index;
    -	Tag * leftTag; // ptr to left-tag in a left-right tag pair
    -	Tag * parent;  // ptr to parent left-tag in a nested tag
    -	Tag * prev;
    -	Tag * next;
    -	TQString tag;
    -    };
    -    TQTextEditOptimPrivate()
    -    {
    -	len = numLines = maxLineWidth = 0;
    -	selStart.line = selStart.index = -1;
    -	selEnd.line = selEnd.index = -1;
    -	search.line = search.index = 0;
    -	tags = lastTag = 0;
    -    }
    -    void clearTags()
    -    {
    -	Tag * itr = tags;
    -	while ( tags ) {
    -	    itr  = tags;
    -	    tags = tags->next;
    -	    delete itr;
    -	}
    -	tags = lastTag = 0;
    -	tagIndex.clear();
    -    }
    -    ~TQTextEditOptimPrivate()
    -    {
    -	clearTags();
    -    }
    -    int len;
    -    int numLines;
    -    int maxLineWidth;
    -    struct Selection {
    -	int line;
    -	int index;
    -    };
    -    Selection selStart, selEnd, search;
    -    Tag * tags, * lastTag;
    -    TQMap<int, TQString> lines;
    -    TQMap<int, Tag *> tagIndex;
    -};
    -#endif
    -
    -class TQ_EXPORT TQTextEdit : public TQScrollView
    -{
    -    friend class TQTextBrowser;
    -    friend class TQSyntaxHighlighter;
    -
    -    TQ_OBJECT
    -    TQ_ENUMS( WordWrap WrapPolicy )
    -    TQ_SETS( AutoFormatting )
    -    TQ_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat )
    -    TQ_PROPERTY( TQString text READ text WRITE setText )
    -    TQ_PROPERTY( TQBrush paper READ paper WRITE setPaper )
    -    TQ_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline )
    -    TQ_PROPERTY( TQString documentTitle READ documentTitle )
    -    TQ_PROPERTY( int length READ length )
    -    TQ_PROPERTY( WordWrap wordWrap READ wordWrap WRITE setWordWrap )
    -    TQ_PROPERTY( int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth )
    -    TQ_PROPERTY( WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy )
    -    TQ_PROPERTY( bool hasSelectedText READ hasSelectedText )
    -    TQ_PROPERTY( TQString selectedText READ selectedText )
    -    TQ_PROPERTY( int undoDepth READ undoDepth WRITE setUndoDepth )
    -    TQ_PROPERTY( bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode )
    -    TQ_PROPERTY( bool modified READ isModified WRITE setModified DESIGNABLE false )
    -    TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
    -    TQ_PROPERTY( bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled )
    -    TQ_PROPERTY( int tabStopWidth READ tabStopWidth WRITE setTabStopWidth )
    -    TQ_PROPERTY( bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus )
    -    TQ_PROPERTY( AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting )
    -
    -public:
    -    enum WordWrap {
    -	NoWrap,
    -	WidgetWidth,
    -	FixedPixelWidth,
    -	FixedColumnWidth
    -    };
    -
    -    enum WrapPolicy {
    -	AtWordBoundary,
    -	AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated
    -	Anywhere,
    -	AtWordOrDocumentBoundary
    -    };
    -
    -    enum AutoFormatting {
    -	AutoNone = 0,
    -	AutoBulletList = 0x00000001,
    -	AutoAll = 0xffffffff
    -    };
    -
    -    enum KeyboardAction {
    -	ActionBackspace,
    -	ActionDelete,
    -	ActionReturn,
    -	ActionKill,
    -	ActionWordBackspace,
    -	ActionWordDelete
    -    };
    -
    -    enum CursorAction {
    -	MoveBackward,
    -	MoveForward,
    -	MoveWordBackward,
    -	MoveWordForward,
    -	MoveUp,
    -	MoveDown,
    -	MoveLineStart,
    -	MoveLineEnd,
    -	MoveHome,
    -	MoveEnd,
    -	MovePgUp,
    -	MovePgDown
    -    };
    -
    -    enum VerticalAlignment {
    -	AlignNormal,
    -	AlignSuperScript,
    -	AlignSubScript
    -    };
    -
    -    enum TextInsertionFlags {
    -	RedoIndentation = 0x0001,
    -	CheckNewLines = 0x0002,
    -	RemoveSelected = 0x0004
    -    };
    -
    -    TQTextEdit( const TQString& text, const TQString& context = TQString::null,
    -	       TQWidget* parent=0, const char* name=0);
    -    TQTextEdit( TQWidget* parent=0, const char* name=0 );
    -    virtual ~TQTextEdit();
    -    void setPalette( const TQPalette & );
    -
    -    TQString text() const;
    -    TQString text( int para ) const;
    -    TextFormat textFormat() const;
    -    TQString context() const;
    -    TQString documentTitle() const;
    -
    -    void getSelection( int *paraFrom, int *indexFrom,
    -		    int *paraTo, int *indexTo, int selNum = 0 ) const;
    -    virtual bool find( const TQString &expr, bool cs, bool wo, bool forward = TRUE,
    -		       int *para = 0, int *index = 0 );
    -
    -    int paragraphs() const;
    -    int lines() const;
    -    int linesOfParagraph( int para ) const;
    -    int lineOfChar( int para, int chr );
    -    int length() const;
    -    TQRect paragraphRect( int para ) const;
    -    int paragraphAt( const TQPoint &pos ) const;
    -    int charAt( const TQPoint &pos, int *para ) const;
    -    int paragraphLength( int para ) const;
    -
    -    TQStyleSheet* styleSheet() const;
    -#ifndef TQT_NO_MIME
    -    TQMimeSourceFactory* mimeSourceFactory() const;
    -#endif
    -    TQBrush paper() const;
    -    bool linkUnderline() const;
    -
    -    int heightForWidth( int w ) const;
    -
    -    bool hasSelectedText() const;
    -    TQString selectedText() const;
    -    bool isUndoAvailable() const;
    -    bool isRedoAvailable() const;
    -
    -    WordWrap wordWrap() const;
    -    int wrapColumnOrWidth() const;
    -    WrapPolicy wrapPolicy() const;
    -
    -    int tabStopWidth() const;
    -
    -    TQString anchorAt( const TQPoint& pos );
    -    TQString anchorAt( const TQPoint& pos, AnchorAttribute a );
    -
    -    TQSize sizeHint() const;
    -
    -    bool isReadOnly() const { return readonly; }
    -
    -    void getCursorPosition( int *parag, int *index ) const;
    -
    -    bool isModified() const;
    -    bool italic() const;
    -    bool bold() const;
    -    bool underline() const;
    -    TQString family() const;
    -    int pointSize() const;
    -    TQColor color() const;
    -    TQFont font() const;
    -    TQFont currentFont() const;
    -    int alignment() const;
    -    int undoDepth() const;
    -
    -    // do not use, will go away
    -    virtual bool getFormat( int para, int index, TQFont *font, TQColor *color, VerticalAlignment *verticalAlignment );
    -    // do not use, will go away
    -    virtual bool getParagraphFormat( int para, TQFont *font, TQColor *color,
    -				     VerticalAlignment *verticalAlignment, int *alignment,
    -				     TQStyleSheetItem::DisplayMode *displayMode,
    -				     TQStyleSheetItem::ListStyle *listStyle,
    -				     int *listDepth );
    -
    -
    -    bool isOverwriteMode() const { return overWrite; }
    -    TQColor paragraphBackgroundColor( int para ) const;
    -
    -    bool isUndoRedoEnabled() const;
    -    bool eventFilter( TQObject *o, TQEvent *e );
    -    bool tabChangesFocus() const;
    -
    -    void setAutoFormatting( uint features );
    -    uint autoFormatting() const;
    -    TQSyntaxHighlighter *syntaxHighlighter() const;
    -
    -public slots:
    -    void setEnabled( bool );
    -#ifndef TQT_NO_MIME
    -    virtual void setMimeSourceFactory( TQMimeSourceFactory* factory );
    -#endif
    -    virtual void setStyleSheet( TQStyleSheet* styleSheet );
    -    virtual void scrollToAnchor( const TQString& name );
    -    virtual void setPaper( const TQBrush& pap );
    -    virtual void setLinkUnderline( bool );
    -
    -    virtual void setWordWrap( WordWrap mode );
    -    virtual void setWrapColumnOrWidth( int );
    -    virtual void setWrapPolicy( WrapPolicy policy );
    -
    -    virtual void copy();
    -    virtual void append( const TQString& text );
    -
    -    void setText( const TQString &txt ) { setText( txt, TQString::null ); }
    -    virtual void setText( const TQString &txt, const TQString &context );
    -    virtual void setTextFormat( TextFormat f );
    -
    -    virtual void selectAll( bool select = TRUE );
    -    virtual void setTabStopWidth( int ts );
    -    virtual void zoomIn( int range );
    -    virtual void zoomIn() { zoomIn( 1 ); }
    -    virtual void zoomOut( int range );
    -    virtual void zoomOut() { zoomOut( 1 ); }
    -    virtual void zoomTo( int size );
    -
    -    virtual void sync();
    -    virtual void setReadOnly( bool b );
    -
    -    virtual void undo();
    -    virtual void redo();
    -    virtual void cut();
    -    virtual void paste();
    -#ifndef TQT_NO_CLIPBOARD
    -    virtual void pasteSubType( const TQCString &subtype );
    -#endif
    -    virtual void clear();
    -    virtual void del();
    -    virtual void indent();
    -    virtual void setItalic( bool b );
    -    virtual void setBold( bool b );
    -    virtual void setUnderline( bool b );
    -    virtual void setFamily( const TQString &f );
    -    virtual void setPointSize( int s );
    -    virtual void setColor( const TQColor &c );
    -    virtual void setFont( const TQFont &f );
    -    virtual void setVerticalAlignment( VerticalAlignment a );
    -    virtual void setAlignment( int a );
    -
    -    // do not use, will go away
    -    virtual void setParagType( TQStyleSheetItem::DisplayMode dm, TQStyleSheetItem::ListStyle listStyle );
    -
    -    virtual void setCursorPosition( int parag, int index );
    -    virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 );
    -    virtual void setSelectionAttributes( int selNum, const TQColor &back, bool invertText );
    -    virtual void setModified( bool m );
    -    virtual void resetFormat();
    -    virtual void setUndoDepth( int d );
    -    virtual void setFormat( TQTextFormat *f, int flags );
    -    virtual void ensureCursorVisible();
    -    virtual void placeCursor( const TQPoint &pos, TQTextCursor *c = 0 );
    -    virtual void moveCursor( CursorAction action, bool select );
    -    virtual void doKeyboardAction( KeyboardAction action );
    -    virtual void removeSelectedText( int selNum = 0 );
    -    virtual void removeSelection( int selNum = 0 );
    -    virtual void setCurrentFont( const TQFont &f );
    -    virtual void setOverwriteMode( bool b ) { overWrite = b; }
    -
    -    virtual void scrollToBottom();
    -
    -    void insert( const TQString &text, uint insertionFlags = CheckNewLines | RemoveSelected ); // ## virtual in 4.0
    -
    -    // obsolete
    -    virtual void insert( const TQString &text, bool, bool = TRUE, bool = TRUE );
    -
    -    virtual void insertAt( const TQString &text, int para, int index );
    -    virtual void removeParagraph( int para );
    -    virtual void insertParagraph( const TQString &text, int para );
    -
    -    virtual void setParagraphBackgroundColor( int para, const TQColor &bg );
    -    virtual void clearParagraphBackground( int para );
    -
    -    virtual void setUndoRedoEnabled( bool b );
    -    void setTabChangesFocus( bool b ); // ### make virtual in 4.0
    -
    -#ifdef QT_TEXTEDIT_OPTIMIZATION
    -    void polish();
    -    void setMaxLogLines( int numLines );
    -    int maxLogLines();
    -#endif
    -
    -signals:
    -    void textChanged();
    -    void selectionChanged();
    -    void copyAvailable( bool );
    -    void undoAvailable( bool yes );
    -    void redoAvailable( bool yes );
    -    void currentFontChanged( const TQFont &f );
    -    void currentColorChanged( const TQColor &c );
    -    void currentAlignmentChanged( int a );
    -    void currentVerticalAlignmentChanged( VerticalAlignment a );
    -    void cursorPositionChanged( TQTextCursor *c );
    -    void cursorPositionChanged( int para, int pos );
    -    void returnPressed();
    -    void modificationChanged( bool m );
    -    void clicked( int parag, int index );
    -    void doubleClicked( int parag, int index );
    -
    -protected:
    -    void repaintChanged();
    -    void updateStyles();
    -    void drawContents( TQPainter *p, int cx, int cy, int cw, int ch );
    -    bool event( TQEvent *e );
    -    void keyPressEvent( TQKeyEvent *e );
    -    void resizeEvent( TQResizeEvent *e );
    -    void viewportResizeEvent( TQResizeEvent* );
    -    void contentsMousePressEvent( TQMouseEvent *e );
    -    void contentsMouseMoveEvent( TQMouseEvent *e );
    -    void contentsMouseReleaseEvent( TQMouseEvent *e );
    -    void contentsMouseDoubleClickEvent( TQMouseEvent *e );
    -#ifndef TQT_NO_WHEELEVENT
    -    void contentsWheelEvent( TQWheelEvent *e );
    -#endif
    -    void imStartEvent( TQIMEvent * );
    -    void imComposeEvent( TQIMEvent * );
    -    void imEndEvent( TQIMEvent * );
    -#ifndef TQT_NO_DRAGANDDROP
    -    void contentsDragEnterEvent( TQDragEnterEvent *e );
    -    void contentsDragMoveEvent( TQDragMoveEvent *e );
    -    void contentsDragLeaveEvent( TQDragLeaveEvent *e );
    -    void contentsDropEvent( TQDropEvent *e );
    -#endif
    -    void contentsContextMenuEvent( TQContextMenuEvent *e );
    -    bool focusNextPrevChild( bool next );
    -    TQTextDocument *document() const;
    -    TQTextCursor *textCursor() const;
    -    void setDocument( TQTextDocument *doc );
    -    virtual TQPopupMenu *createPopupMenu( const TQPoint& pos );
    -    virtual TQPopupMenu *createPopupMenu();
    -    void drawCursor( bool visible );
    -
    -    void windowActivationChange( bool );
    -
    -protected slots:
    -    virtual void doChangeInterval();
    -    void sliderReleased(); // ### make virtual in 4.0
    -
    -private slots:
    -    void formatMore();
    -    void doResize();
    -    void autoScrollTimerDone();
    -    void blinkCursor();
    -    void setModified();
    -    void startDrag();
    -    void documentWidthChanged( int w );
    -    void clipboardChanged();
    -
    -private:
    -    struct TQ_EXPORT UndoRedoInfo {
    -	enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style, IME };
    -
    -	UndoRedoInfo( TQTextDocument *dc );
    -	~UndoRedoInfo();
    -	void clear();
    -	bool valid() const;
    -
    -	TQUndoRedoInfoPrivate *d;
    -	int id;
    -	int index;
    -	int eid;
    -	int eindex;
    -	TQTextFormat *format;
    -	int flags;
    -	Type type;
    -	TQTextDocument *doc;
    -	TQByteArray styleInformation;
    -    };
    -
    -private:
    -    void updateCursor( const TQPoint & pos );
    -    void handleMouseMove( const TQPoint& pos );
    -    void drawContents( TQPainter * );
    -    virtual bool linksEnabled() const { return FALSE; }
    -    void init();
    -    void checkUndoRedoInfo( UndoRedoInfo::Type t );
    -    void updateCurrentFormat();
    -    bool handleReadOnlyKeyEvent( TQKeyEvent *e );
    -    void makeParagVisible( TQTextParagraph *p );
    -    void normalCopy();
    -    void copyToClipboard();
    -#ifndef TQT_NO_MIME
    -    TQCString pickSpecial(TQMimeSource* ms, bool always_ask, const TQPoint&);
    -    TQTextDrag *dragObject( TQWidget *parent = 0 ) const;
    -#endif
    -#ifndef TQT_NO_MIMECLIPBOARD
    -    void pasteSpecial(const TQPoint&);
    -#endif
    -    void setFontInternal( const TQFont &f );
    -
    -    virtual void emitHighlighted( const TQString & ) {}
    -    virtual void emitLinkClicked( const TQString & ) {}
    -
    -    void readFormats( TQTextCursor &c1, TQTextCursor &c2, TQTextString &text, bool fillStyles = FALSE );
    -    void clearUndoRedo();
    -    void paintDocument( bool drawAll, TQPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 );
    -    void moveCursor( CursorAction action );
    -    void ensureFormatted( TQTextParagraph *p );
    -    void placeCursor( const TQPoint &pos, TQTextCursor *c, bool link );
    -    void updateMicroFocusHint();
    -
    -#ifdef QT_TEXTEDIT_OPTIMIZATION
    -    bool checkOptimMode();
    -    TQString optimText() const;
    -    void optimSetText( const TQString &str );
    -    void optimAppend( const TQString &str );
    -    void optimInsert( const TQString &str, int line, int index );
    -    void optimDrawContents( TQPainter * p, int cx, int cy, int cw, int ch );
    -    void optimMousePressEvent( TQMouseEvent * e );
    -    void optimMouseReleaseEvent( TQMouseEvent * e );
    -    void optimMouseMoveEvent( TQMouseEvent * e );
    -    int  optimCharIndex( const TQString &str, int mx ) const;
    -    void optimSelectAll();
    -    void optimRemoveSelection();
    -    void optimSetSelection( int startLine, int startIdx, int endLine,
    -			    int endIdx );
    -    bool optimHasSelection() const;
    -    TQString optimSelectedText() const;
    -    bool optimFind( const TQString & str, bool, bool, bool, int *, int * );
    -    void optimParseTags( TQString * str, int lineNo = -1, int indexOffset = 0 );
    -    TQTextEditOptimPrivate::Tag * optimPreviousLeftTag( int line );
    -    void optimSetTextFormat( TQTextDocument *, TQTextCursor *, TQTextFormat * f,
    -			     int, int, TQTextEditOptimPrivate::Tag * t );
    -    TQTextEditOptimPrivate::Tag * optimAppendTag( int index, const TQString & tag );
    -    TQTextEditOptimPrivate::Tag * optimInsertTag( int line, int index, const TQString & tag );
    -    void optimCheckLimit( const TQString& str );
    -    bool optimHasBoldMetrics( int line );
    -
    -private slots:
    -    void optimDoAutoScroll();
    -#endif // QT_TEXTEDIT_OPTIMIZATION
    -
    -private:
    -#ifndef TQT_NO_CLIPBOARD
    -    void pasteSubType( const TQCString &subtype, TQMimeSource *m );
    -#endif
    -
    -private:
    -    TQTextDocument *doc;
    -    TQTextCursor *cursor;
    -    TQTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer;
    -    TQTextParagraph *lastFormatted;
    -    int interval;
    -    UndoRedoInfo undoRedoInfo;
    -    TQTextFormat *currentFormat;
    -    int currentAlignment;
    -    TQPoint oldMousePos, mousePos;
    -    TQPoint dragStartPos;
    -    TQString onLink;
    -    WordWrap wrapMode;
    -    WrapPolicy wPolicy;
    -    int wrapWidth;
    -    TQString pressedLink;
    -    TQTextEditPrivate *d;
    -    bool inDoubleClick : 1;
    -    bool mousePressed : 1;
    -    bool cursorVisible : 1;
    -    bool blinkCursorVisible : 1;
    -    bool readOnly : 1;
    -    bool modified : 1;
    -    bool mightStartDrag : 1;
    -    bool inDnD : 1;
    -    bool readonly : 1;
    -    bool undoEnabled : 1;
    -    bool overWrite : 1;
    -
    -private:	// Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQTextEdit( const TQTextEdit & );
    -    TQTextEdit &operator=( const TQTextEdit & );
    -#endif
    -};
    -
    -inline TQTextDocument *TQTextEdit::document() const
    -{
    -    return doc;
    -}
    -
    -inline TQTextCursor *TQTextEdit::textCursor() const
    -{
    -    return cursor;
    -}
    -
    -inline void TQTextEdit::setCurrentFont( const TQFont &f )
    -{
    -    TQTextEdit::setFontInternal( f );
    -}
    -
    -#endif //TQT_NO_TEXTEDIT
    -#endif //TQTEXTVIEW_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextedit-members.html b/doc/html/qtextedit-members.html deleted file mode 100644 index ed3aeba9..00000000 --- a/doc/html/qtextedit-members.html +++ /dev/null @@ -1,544 +0,0 @@ - - - - - -TQTextEdit Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextEdit

    - -

    This is the complete list of member functions for -TQTextEdit, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextencoder-members.html b/doc/html/qtextencoder-members.html deleted file mode 100644 index dbe9c69f..00000000 --- a/doc/html/qtextencoder-members.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - -TQTextEncoder Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextEncoder

    - -

    This is the complete list of member functions for -TQTextEncoder, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextencoder.html b/doc/html/qtextencoder.html deleted file mode 100644 index 410dd59b..00000000 --- a/doc/html/qtextencoder.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - -TQTextEncoder Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextEncoder Class Reference

    - -

    The TQTextEncoder class provides a state-based encoder. -More... -

    All the functions in this class are reentrant when TQt is built with thread support.

    -

    #include <ntqtextcodec.h> -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQTextEncoder class provides a state-based encoder. - - -

    The encoder converts Unicode into another format, remembering any -state that is required between calls. -

    See also TQTextCodec::makeEncoder() and Internationalization with TQt. - -


    Member Function Documentation

    -

    TQTextEncoder::~TQTextEncoder () [virtual] -

    -Destroys the encoder. - -

    TQCString TQTextEncoder::fromUnicode ( const TQString & uc, int & lenInOut ) [pure virtual] -

    - -

    Converts lenInOut characters (not bytes) from uc, producing -a TQCString. lenInOut will be set to the length of the result (in bytes). -

    The encoder is free to record state to use when subsequent calls -are made to this function (for example, it might change modes with -escape sequences if needed during the encoding of one string, then -assume that mode applies when a subsequent call begins). - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextistream-members.html b/doc/html/qtextistream-members.html deleted file mode 100644 index e6490902..00000000 --- a/doc/html/qtextistream-members.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - -TQTextIStream Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextIStream

    - -

    This is the complete list of member functions for -TQTextIStream, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextistream.html b/doc/html/qtextistream.html deleted file mode 100644 index dd06f52c..00000000 --- a/doc/html/qtextistream.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - -TQTextIStream Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextIStream Class Reference

    - -

    The TQTextIStream class is a convenience class for input streams. -More... -

    All the functions in this class are reentrant when TQt is built with thread support.

    -

    #include <ntqtextstream.h> -

    Inherits TQTextStream. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - - -The TQTextIStream class is a convenience class for input streams. -

    - -

    This class provides a shorthand for creating simple input -TQTextStreams without having to pass a mode argument to the -constructor. -

    This class makes it easy, for example, to write things like this: -

    -    TQString data = "123 456";
    -    int a, b;
    -    TQTextIStream(&data) >> a >> b;
    -    
    - -

    See also TQTextOStream, Input/Output and Networking, and Text Related Classes. - -


    Member Function Documentation

    -

    TQTextIStream::TQTextIStream ( const TQString * s ) -

    - -

    Constructs a stream to read from the string s. - -

    TQTextIStream::TQTextIStream ( TQByteArray ba ) -

    - -

    Constructs a stream to read from the array ba. - -

    TQTextIStream::TQTextIStream ( FILE * f ) -

    - -

    Constructs a stream to read from the file f. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextostream-members.html b/doc/html/qtextostream-members.html deleted file mode 100644 index 2dfa17d9..00000000 --- a/doc/html/qtextostream-members.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - -TQTextOStream Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextOStream

    - -

    This is the complete list of member functions for -TQTextOStream, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextostream.html b/doc/html/qtextostream.html deleted file mode 100644 index 6e4d9994..00000000 --- a/doc/html/qtextostream.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - -TQTextOStream Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQTextOStream Class Reference

    - -

    The TQTextOStream class is a convenience class for output streams. -More... -

    All the functions in this class are reentrant when TQt is built with thread support.

    -

    #include <ntqtextstream.h> -

    Inherits TQTextStream. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - - -The TQTextOStream class is a convenience class for output streams. -

    - -

    This class provides a shorthand for creating simple output -TQTextStreams without having to pass a mode argument to the -constructor. -

    This makes it easy for example, to write things like this: -

    -    TQString result;
    -    TQTextOStream(&result) << "pi = " << 3.14;
    -    
    - -

    See also Input/Output and Networking and Text Related Classes. - -


    Member Function Documentation

    -

    TQTextOStream::TQTextOStream ( TQString * s ) -

    - -

    Constructs a stream to write to string s. - -

    TQTextOStream::TQTextOStream ( TQByteArray ba ) -

    - -

    Constructs a stream to write to the array ba. - -

    TQTextOStream::TQTextOStream ( FILE * f ) -

    - -

    Constructs a stream to write to the file f. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextstream-h.html b/doc/html/qtextstream-h.html deleted file mode 100644 index 8ced9458..00000000 --- a/doc/html/qtextstream-h.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - -ntqtextstream.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqtextstream.h

    - -

    This is the verbatim text of the ntqtextstream.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqtextstream.h   3.3.8   edited Jan 11 14:38 $
    -**
    -** Definition of TQTextStream class
    -**
    -** Created : 940922
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the tools module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQTEXTSTREAM_H
    -#define TQTEXTSTREAM_H
    -
    -#ifndef QT_H
    -#include "ntqiodevice.h"
    -#include "tqstring.h"
    -#include <stdio.h>
    -#endif // QT_H
    -
    -#ifndef TQT_NO_TEXTSTREAM
    -class TQTextCodec;
    -class TQTextDecoder;
    -
    -class TQTextStreamPrivate;
    -
    -class TQ_EXPORT TQTextStream				// text stream class
    -{
    -public:
    -    enum Encoding { Locale, Latin1, Unicode, UnicodeNetworkOrder,
    -		    UnicodeReverse, RawUnicode, UnicodeUTF8 };
    -
    -    void	setEncoding( Encoding );
    -#ifndef TQT_NO_TEXTCODEC
    -    void	setCodec( TQTextCodec* );
    -    TQTextCodec *codec();
    -#endif
    -
    -    TQTextStream();
    -    TQTextStream( TQIODevice * );
    -    TQTextStream( TQString*, int mode );
    -    TQTextStream( TQString&, int mode );		// obsolete
    -    TQTextStream( TQByteArray, int mode );
    -    TQTextStream( FILE *, int mode );
    -    virtual ~TQTextStream();
    -
    -    TQIODevice	*device() const;
    -    void	 setDevice( TQIODevice * );
    -    void	 unsetDevice();
    -
    -    bool	 atEnd() const;
    -    bool	 eof() const;
    -
    -    TQTextStream &operator>>( TQChar & );
    -    TQTextStream &operator>>( char & );
    -    TQTextStream &operator>>( signed short & );
    -    TQTextStream &operator>>( unsigned short & );
    -    TQTextStream &operator>>( signed int & );
    -    TQTextStream &operator>>( unsigned int & );
    -    TQTextStream &operator>>( signed long & );
    -    TQTextStream &operator>>( unsigned long & );
    -    TQTextStream &operator>>( float & );
    -    TQTextStream &operator>>( double & );
    -    TQTextStream &operator>>( char * );
    -    TQTextStream &operator>>( TQString & );
    -    TQTextStream &operator>>( TQCString & );
    -
    -    TQTextStream &operator<<( TQChar );
    -    TQTextStream &operator<<( char );
    -    TQTextStream &operator<<( signed short );
    -    TQTextStream &operator<<( unsigned short );
    -    TQTextStream &operator<<( signed int );
    -    TQTextStream &operator<<( unsigned int );
    -    TQTextStream &operator<<( signed long );
    -    TQTextStream &operator<<( unsigned long );
    -    TQTextStream &operator<<( float );
    -    TQTextStream &operator<<( double );
    -    TQTextStream &operator<<( const char* );
    -    TQTextStream &operator<<( const TQString & );
    -    TQTextStream &operator<<( const TQCString & );
    -    TQTextStream &operator<<( void * );		// any pointer
    -
    -    TQTextStream &readRawBytes( char *, uint len );
    -    TQTextStream &writeRawBytes( const char* , uint len );
    -
    -    TQString	readLine();
    -    TQString	read();
    -    void	skipWhiteSpace();
    -
    -    enum {
    -	skipws	  = 0x0001,			// skip whitespace on input
    -	left	  = 0x0002,			// left-adjust output
    -	right	  = 0x0004,			// right-adjust output
    -	internal  = 0x0008,			// pad after sign
    -	bin	  = 0x0010,			// binary format integer
    -	oct	  = 0x0020,			// octal format integer
    -	dec	  = 0x0040,			// decimal format integer
    -	hex	  = 0x0080,			// hex format integer
    -	showbase  = 0x0100,			// show base indicator
    -	showpoint = 0x0200,			// force decimal point (float)
    -	uppercase = 0x0400,			// upper-case hex output
    -	showpos	  = 0x0800,			// add '+' to positive integers
    -	scientific= 0x1000,			// scientific float output
    -	fixed	  = 0x2000			// fixed float output
    -    };
    -
    -    static const int basefield;			// bin | oct | dec | hex
    -    static const int adjustfield;		// left | right | internal
    -    static const int floatfield;		// scientific | fixed
    -
    -    int	  flags() const;
    -    int	  flags( int f );
    -    int	  setf( int bits );
    -    int	  setf( int bits, int mask );
    -    int	  unsetf( int bits );
    -
    -    void  reset();
    -
    -    int	  width()	const;
    -    int	  width( int );
    -    int	  fill()	const;
    -    int	  fill( int );
    -    int	  precision()	const;
    -    int	  precision( int );
    -
    -private:
    -    long	input_int();
    -    void	init();
    -    TQTextStream &output_int( int, ulong, bool );
    -    TQIODevice	*dev;
    -
    -    int		fflags;
    -    int		fwidth;
    -    int		fillchar;
    -    int		fprec;
    -    bool	doUnicodeHeader;
    -    bool	owndev;
    -    TQTextCodec 	*mapper;
    -    TQTextStreamPrivate * d;
    -    TQChar	unused1; // ### remove in TQt 4.0
    -    bool	latin1;
    -    bool 	internalOrder;
    -    bool	networkOrder;
    -    void	*unused2; // ### remove in TQt 4.0
    -
    -    TQChar	eat_ws();
    -    uint 	ts_getline( TQChar* );
    -    void	ts_ungetc( TQChar );
    -    TQChar	ts_getc();
    -    uint	ts_getbuf( TQChar*, uint );
    -    void	ts_putc(int);
    -    void	ts_putc(TQChar);
    -    bool	ts_isspace(TQChar);
    -    bool	ts_isdigit(TQChar);
    -    ulong	input_bin();
    -    ulong	input_oct();
    -    ulong	input_dec();
    -    ulong	input_hex();
    -    double	input_double();
    -    TQTextStream &writeBlock( const char* p, uint len );
    -    TQTextStream &writeBlock( const TQChar* p, uint len );
    -
    -private:	// Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQTextStream( const TQTextStream & );
    -    TQTextStream &operator=( const TQTextStream & );
    -#endif
    -};
    -
    -typedef TQTextStream TQTS;
    -
    -class TQ_EXPORT TQTextIStream : public TQTextStream {
    -public:
    -    TQTextIStream( const TQString* s ) :
    -	TQTextStream((TQString*)s,IO_ReadOnly) { }
    -    TQTextIStream( TQByteArray ba ) :
    -	TQTextStream(ba,IO_ReadOnly) { }
    -    TQTextIStream( FILE *f ) :
    -	TQTextStream(f,IO_ReadOnly) { }
    -
    -private:	// Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQTextIStream( const TQTextIStream & );
    -    TQTextIStream &operator=( const TQTextIStream & );
    -#endif
    -};
    -
    -class TQ_EXPORT TQTextOStream : public TQTextStream {
    -public:
    -    TQTextOStream( TQString* s ) :
    -	TQTextStream(s,IO_WriteOnly) { }
    -    TQTextOStream( TQByteArray ba ) :
    -	TQTextStream(ba,IO_WriteOnly) { }
    -    TQTextOStream( FILE *f ) :
    -	TQTextStream(f,IO_WriteOnly) { }
    -
    -private:	// Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQTextOStream( const TQTextOStream & );
    -    TQTextOStream &operator=( const TQTextOStream & );
    -#endif
    -};
    -
    -/*****************************************************************************
    -  TQTextStream inline functions
    - *****************************************************************************/
    -
    -inline TQIODevice *TQTextStream::device() const
    -{ return dev; }
    -
    -inline bool TQTextStream::atEnd() const
    -{ return dev ? dev->atEnd() : FALSE; }
    -
    -inline bool TQTextStream::eof() const
    -{ return atEnd(); }
    -
    -inline int TQTextStream::flags() const
    -{ return fflags; }
    -
    -inline int TQTextStream::flags( int f )
    -{ int oldf = fflags;  fflags = f;  return oldf; }
    -
    -inline int TQTextStream::setf( int bits )
    -{ int oldf = fflags;  fflags |= bits;  return oldf; }
    -
    -inline int TQTextStream::setf( int bits, int mask )
    -{ int oldf = fflags;  fflags = (fflags & ~mask) | (bits & mask); return oldf; }
    -
    -inline int TQTextStream::unsetf( int bits )
    -{ int oldf = fflags;  fflags &= ~bits;	return oldf; }
    -
    -inline int TQTextStream::width() const
    -{ return fwidth; }
    -
    -inline int TQTextStream::width( int w )
    -{ int oldw = fwidth;  fwidth = w;  return oldw;	 }
    -
    -inline int TQTextStream::fill() const
    -{ return fillchar; }
    -
    -inline int TQTextStream::fill( int f )
    -{ int oldc = fillchar;	fillchar = f;  return oldc;  }
    -
    -inline int TQTextStream::precision() const
    -{ return fprec; }
    -
    -inline int TQTextStream::precision( int p )
    -{ int oldp = fprec;  fprec = p;	 return oldp;  }
    -
    -/*!
    -  Returns one character from the stream, or EOF.
    -*/
    -inline TQChar TQTextStream::ts_getc()
    -{ TQChar r; return ( ts_getbuf( &r,1 ) == 1 ? r : TQChar((ushort)0xffff) ); }
    -
    -/*****************************************************************************
    -  TQTextStream manipulators
    - *****************************************************************************/
    -
    -typedef TQTextStream & (*TQTSFUNC)(TQTextStream &);// manipulator function
    -typedef int (TQTextStream::*TQTSMFI)(int);	// manipulator w/int argument
    -
    -class TQ_EXPORT TQTSManip {			// text stream manipulator
    -public:
    -    TQTSManip( TQTSMFI m, int a ) { mf=m; arg=a; }
    -    void exec( TQTextStream &s ) { (s.*mf)(arg); }
    -private:
    -    TQTSMFI mf;					// TQTextStream member function
    -    int	   arg;					// member function argument
    -};
    -
    -TQ_EXPORT inline TQTextStream &operator>>( TQTextStream &s, TQTSFUNC f )
    -{ return (*f)( s ); }
    -
    -TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSFUNC f )
    -{ return (*f)( s ); }
    -
    -TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSManip m )
    -{ m.exec(s); return s; }
    -
    -TQ_EXPORT TQTextStream &bin( TQTextStream &s );	// set bin notation
    -TQ_EXPORT TQTextStream &oct( TQTextStream &s );	// set oct notation
    -TQ_EXPORT TQTextStream &dec( TQTextStream &s );	// set dec notation
    -TQ_EXPORT TQTextStream &hex( TQTextStream &s );	// set hex notation
    -TQ_EXPORT TQTextStream &endl( TQTextStream &s );	// insert EOL ('\n')
    -TQ_EXPORT TQTextStream &flush( TQTextStream &s );	// flush output
    -TQ_EXPORT TQTextStream &ws( TQTextStream &s );	// eat whitespace on input
    -TQ_EXPORT TQTextStream &reset( TQTextStream &s );	// set default flags
    -
    -TQ_EXPORT inline TQTSManip qSetW( int w )
    -{
    -    TQTSMFI func = &TQTextStream::width;
    -    return TQTSManip(func,w);
    -}
    -
    -TQ_EXPORT inline TQTSManip qSetFill( int f )
    -{
    -    TQTSMFI func = &TQTextStream::fill;
    -    return TQTSManip(func,f);
    -}
    -
    -TQ_EXPORT inline TQTSManip qSetPrecision( int p )
    -{
    -    TQTSMFI func = &TQTextStream::precision;
    -    return TQTSManip(func,p);
    -}
    -
    -#endif // TQT_NO_TEXTSTREAM
    -#endif // TQTEXTSTREAM_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextstream-members.html b/doc/html/qtextstream-members.html deleted file mode 100644 index 3c75a892..00000000 --- a/doc/html/qtextstream-members.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - -TQTextStream Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextStream

    - -

    This is the complete list of member functions for -TQTextStream, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextview-h.html b/doc/html/qtextview-h.html deleted file mode 100644 index 9c2aa2ba..00000000 --- a/doc/html/qtextview-h.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - -ntqtextview.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqtextview.h

    - -

    This is the verbatim text of the ntqtextview.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqtextview.h   3.3.8   edited Jan 11 14:39 $
    -**
    -** Definition of the TQTextView class
    -**
    -** Created : 990101
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the widgets module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQTEXTVIEW_H
    -#define TQTEXTVIEW_H
    -
    -#ifndef QT_H
    -#include "ntqtextedit.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_TEXTVIEW
    -
    -class TQ_EXPORT TQTextView : public TQTextEdit
    -{
    -    TQ_OBJECT
    -    TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false )
    -    TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false )
    -    TQ_OVERRIDE( bool modified SCRIPTABLE false)
    -    TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false )
    -    TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false )
    -
    -public:
    -    TQTextView( const TQString& text, const TQString& context = TQString::null,
    -	       TQWidget* parent=0, const char* name=0);
    -    TQTextView( TQWidget* parent=0, const char* name=0 );
    -
    -    virtual ~TQTextView();
    -
    -private:
    -#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator=
    -    TQTextView( const TQTextView & );
    -    TQTextView &operator=( const TQTextView & );
    -#endif
    -};
    -
    -#endif //TQT_NO_TEXTVIEW
    -#endif //TQTEXTVIEW_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtextview-members.html b/doc/html/qtextview-members.html deleted file mode 100644 index 5b70f3ef..00000000 --- a/doc/html/qtextview-members.html +++ /dev/null @@ -1,543 +0,0 @@ - - - - - -TQTextView Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQTextView

    - -

    This is the complete list of member functions for -TQTextView, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qtsciicodec-h.html b/doc/html/qtsciicodec-h.html index 174a4421..3f979320 100644 --- a/doc/html/qtsciicodec-h.html +++ b/doc/html/qtsciicodec-h.html @@ -105,7 +105,7 @@ body { background: #ffffff; color: black; } #define TQTSCIICODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_CODECS diff --git a/doc/html/qtsciicodec-members.html b/doc/html/qtsciicodec-members.html index 4fd23253..8702dc5b 100644 --- a/doc/html/qtsciicodec-members.html +++ b/doc/html/qtsciicodec-members.html @@ -35,31 +35,31 @@ body { background: #ffffff; color: black; } TQTsciiCodec, including inherited members.


    diff --git a/doc/html/qwerty-example.html b/doc/html/qwerty-example.html index 15e5a950..fe1c4459 100644 --- a/doc/html/qwerty-example.html +++ b/doc/html/qwerty-example.html @@ -113,14 +113,14 @@ private: #include <ntqfile.h> #include <ntqfiledialog.h> #include <ntqpopupmenu.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqpainter.h> #include <ntqmessagebox.h> #include <ntqpaintdevicemetrics.h> #include <tqptrlist.h> #include <ntqfontdialog.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> const bool no_writing = FALSE; @@ -171,7 +171,7 @@ enum { Uni = 0, MBug = 1, Lat1 = 2, Local = 3, Guess = 4, Codec = 5 }; #endif changed = FALSE; e = new TQMultiLineEdit( this, "editor" ); - connect( e, TQ_SIGNAL( textChanged() ), this, TQ_SLOT( textChanged() ) ); + connect( e, TQ_SIGNAL( textChanged() ), this, TQ_SLOT( textChanged() ) ); // We use Unifont - if you have it installed you'll see all // Unicode character glyphs. @@ -193,7 +193,7 @@ Editor::~Editor() { #ifndef TQT_NO_FONTDIALOG bool ok; - TQFont f = TQFontDialog::getFont( &ok, e->font() ); + TQFont f = TQFontDialog::getFont( &ok, e->font() ); if ( ok ) { e->setFont( f ); } @@ -206,16 +206,16 @@ void Editor::rebuildCodecList() { delete codecList; codecList = new TQPtrList<TQTextCodec>; - TQTextCodec *codec; + TQTextCodec *codec; int i; - for (i = 0; (codec = TQTextCodec::codecForIndex(i)); i++) + for (i = 0; (codec = TQTextCodec::codecForIndex(i)); i++) codecList->append( codec ); int n = codecList->count(); for (int pm=0; pm<2; pm++) { TQPopupMenu* menu = pm ? open_as : save_as; menu->clear(); TQString local = "Local ("; - local += TQTextCodec::codecForLocale()->name(); + local += TQTextCodec::codecForLocale()->name(); local += ")"; menu->insertItem( local, Local ); menu->insertItem( "Unicode", Uni ); @@ -258,28 +258,28 @@ void Editor::load( const TQString& fileName, int e->setAutoUpdate( FALSE ); - TQTextStream t(&f); + TQTextStream t(&f); if ( code >= Codec ) - t.setCodec( codecList->at(code-Codec) ); + t.setCodec( codecList->at(code-Codec) ); else if ( code == Uni ) - t.setEncoding( TQTextStream::Unicode ); + t.setEncoding( TQTextStream::Unicode ); else if ( code == MBug ) - t.setEncoding( TQTextStream::UnicodeReverse ); + t.setEncoding( TQTextStream::UnicodeReverse ); else if ( code == Lat1 ) - t.setEncoding( TQTextStream::Latin1 ); + t.setEncoding( TQTextStream::Latin1 ); else if ( code == Guess ) { TQFile f(fileName); f.open(IO_ReadOnly); char buffer[256]; int l = 256; l=f.readBlock(buffer,l); - TQTextCodec* codec = TQTextCodec::codecForContent(buffer, l); + TQTextCodec* codec = TQTextCodec::codecForContent(buffer, l); if ( codec ) { - TQMessageBox::information(this,"Encoding",TQString("Codec: ")+codec->name()); - t.setCodec( codec ); + TQMessageBox::information(this,"Encoding",TQString("Codec: ")+codec->name()); + t.setCodec( codec ); } } - e->setText( t.read() ); + e->setText( t.read() ); f.close(); e->setAutoUpdate( TRUE ); @@ -327,7 +327,7 @@ void Editor::addEncoding() if ( !fn.isEmpty() ) { TQFile f(fn); if (f.open(IO_ReadOnly)) { - if (TQTextCodec::loadCharmap(&f)) { + if (TQTextCodec::loadCharmap(&f)) { rebuildCodecList(); } else { TQMessageBox::warning(0,"Charmap error", @@ -358,16 +358,16 @@ bool Editor::saveAs( const TQStringTQTextStream t(&f); + TQTextStream t(&f); if ( code >= Codec ) - t.setCodec( codecList->at(code-Codec) ); + t.setCodec( codecList->at(code-Codec) ); else if ( code == Uni ) - t.setEncoding( TQTextStream::Unicode ); + t.setEncoding( TQTextStream::Unicode ); else if ( code == MBug ) - t.setEncoding( TQTextStream::UnicodeReverse ); + t.setEncoding( TQTextStream::UnicodeReverse ); else if ( code == Lat1 ) - t.setEncoding( TQTextStream::Latin1 ); - t << e->text(); + t.setEncoding( TQTextStream::Latin1 ); + t << e->text(); f.close(); setCaption( fileName ); changed = FALSE; @@ -381,7 +381,7 @@ void Editor::print() printer.setFullPage(TRUE); // we'll set our own margins TQPainter p; p.begin( &printer ); // paint on printer - p.setFont( e->font() ); + p.setFont( e->font() ); TQFontMetrics fm = p.fontMetrics(); TQPaintDeviceMetrics metrics( &printer ); // need width/height // of printer surface @@ -441,12 +441,12 @@ void Editor::resizeEvent( Editor::toUpper() { - e->setText(e->text().upper()); + e->setText(e->text().upper()); } void Editor::toLower() { - e->setText(e->text().lower()); + e->setText(e->text().lower()); } void Editor::textChanged() diff --git a/doc/html/qwindowsmime.html b/doc/html/qwindowsmime.html index 42e354dc..ea4b0a0b 100644 --- a/doc/html/qwindowsmime.html +++ b/doc/html/qwindowsmime.html @@ -73,7 +73,7 @@ proprietary clipboard formats to MIME formats.

    TQt has predefined support for the following Windows Clipboard formats:

    It declares a class that inherits TQMainWindow, with slots and private -variables. The class pre-declaration of TQTextEdit at the beginning +variables. The class pre-declaration of TQTextEdit at the beginning (instead of an include) helps to speed up compilation. With this trick, make depend won't insist on recompiling every .cpp file that -includes application.h when ntqtextedit.h changes. +includes application.h when tqtextedit.h changes.

    A simple main()

    @@ -319,7 +319,7 @@ will be aligned to the right if the windows system style requires it.

    We create a Help menu, add it to the menu bar, and insert a few commands. Depending on the style it will appear on the right hand side of the menu bar or not. -

            e = new TQTextEdit( this, "editor" );
    +

            e = new TQTextEdit( this, "editor" );
             e->setFocus();
             setCentralWidget( e );
     
    @@ -382,9 +382,9 @@ error message in the statusbar. if ( !f.open( IO_ReadOnly ) ) return; - TQTextStream ts( &f ); - e->setText( ts.read() ); - e->setModified( FALSE ); + TQTextStream ts( &f ); + e->setText( ts.read() ); + e->setModified( FALSE ); setCaption( fileName ); statusBar()->message( "Loaded document " + fileName, 2000 ); } @@ -401,7 +401,7 @@ readable, nothing happens. return; } - TQString text = e->text(); + TQString text = e->text(); TQFile f( filename ); if ( !f.open( IO_WriteOnly ) ) { statusBar()->message( TQString("Could not write to %1").arg(filename), @@ -409,7 +409,7 @@ readable, nothing happens. return; } - TQTextStream t( &f ); + TQTextStream t( &f ); t << text; f.close();
    @@ -418,7 +418,7 @@ filename has been specified so far, the saveAs() functio Note that there is more than one way to do this: compare the above statusBar()->message() line with the equivalent code in the load() function. -

            e->setModified( FALSE );
    +

            e->setModified( FALSE );
     

    Tell the editor that the contents haven't been edited since the last save. When the user does some further editing and wishes to close the @@ -463,11 +463,11 @@ and implicitly changes the window system caption to the new name. int dpiy = metrics.logicalDpiY(); int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins TQRect view( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin ); - TQSimpleRichText richText( TQStyleSheet::convertFromPlainText(e->text()), + TQSimpleRichText richText( TQStyleSheet::convertFromPlainText(e->text()), TQFont(), - e->context(), - e->styleSheet(), - e->mimeSourceFactory(), + e->context(), + e->styleSheet(), + e->mimeSourceFactory(), view.height() ); richText.setWidth( &p, view.width() ); int page = 1; @@ -506,7 +506,7 @@ an ApplicationWindow.

    This event gets to process window system close events. A close event is subtly different from a hide event: hide often means "iconify" whereas close means that the window is going away for good. -

            if ( !e->isModified() ) {
    +

            if ( !e->isModified() ) {
                 ce->accept();
                 return;
             }
    diff --git a/doc/html/simple-font-demo-example.html b/doc/html/simple-font-demo-example.html
    index a5345e38..728f9a0e 100644
    --- a/doc/html/simple-font-demo-example.html
    +++ b/doc/html/simple-font-demo-example.html
    @@ -66,8 +66,8 @@ private:
         void layout();
         void showFontInfo( TQFont & );
     
    -    TQTextView * greetings;
    -    TQTextView * fontInfo;
    +    TQTextView * greetings;
    +    TQTextView * fontInfo;
     
         TQPushButton * defaultButton;
         TQPushButton * sansSerifButton;
    @@ -84,7 +84,7 @@ private:
     #include "viewer.h"
     #include <tqstring.h>
     #include <tqstringlist.h>
    -#include <ntqtextview.h>
    +#include <tqtextview.h>
     #include <ntqpushbutton.h>
     #include <ntqlayout.h>
     
    @@ -97,13 +97,13 @@ private:
         TQString greeting_ru = TQString::fromUtf8( "\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265" );
         TQString greeting_en( "Hello" );
     
    -    greetings = new TQTextView( this, "textview" );
    +    greetings = new TQTextView( this, "textview" );
     
    -    greetings->setText( greeting_en + "\n" +
    +    greetings->setText( greeting_en + "\n" +
                            greeting_ru + "\n" +
                            greeting_heb );
     
    -    fontInfo = new TQTextView( this, "fontinfo" );
    +    fontInfo = new TQTextView( this, "fontinfo" );
     
         setDefault();
     
    @@ -191,7 +191,7 @@ void Viewer::showFontInfo( TQFont
                            font.family() + ".";
         }
     
    -    fontInfo->setText( messageText );
    +    fontInfo->setText( messageText );
     }
     
     void Viewer::setFontSubstitutions()
    diff --git a/doc/html/simple_dd-example.html b/doc/html/simple_dd-example.html
    index e7d35acb..56cfd3a0 100644
    --- a/doc/html/simple_dd-example.html
    +++ b/doc/html/simple_dd-example.html
    @@ -191,7 +191,7 @@ const char* green_icon[]={
     
     void DDListBox::dragEnterEvent( TQDragEnterEvent *evt )
     {
    -    if ( TQTextDrag::canDecode( evt ) )
    +    if ( TQTextDrag::canDecode( evt ) )
             evt->accept();
     }
     
    @@ -200,7 +200,7 @@ const char* green_icon[]={
     {
         TQString text;
     
    -    if ( TQTextDrag::decode( evt, text ) )
    +    if ( TQTextDrag::decode( evt, text ) )
             insertItem( text );
     }
     
    @@ -215,7 +215,7 @@ const char* green_icon[]={
     void DDListBox::mouseMoveEvent( TQMouseEvent * )
     {
         if ( dragging ) {
    -        TQDragObject *d = new TQTextDrag( currentText(), this );
    +        TQDragObject *d = new TQTextDrag( currentText(), this );
             d->dragCopy(); // do NOT delete d.
             dragging = FALSE;
         }
    @@ -237,7 +237,7 @@ const char* green_icon[]={
     {
         TQString label;
     
    -    if ( TQTextDrag::decode( evt, label ) )
    +    if ( TQTextDrag::decode( evt, label ) )
             setText( label );
     }
     
    @@ -246,14 +246,14 @@ const char* green_icon[]={
     
     TQDragObject *DDIconView::dragObject()
     {
    -  return new TQTextDrag( currentItem()->text(), this );
    +  return new TQTextDrag( currentItem()->text(), this );
     }
     
     void DDIconView::slotNewItem( TQDropEvent *evt, const TQValueList<TQIconDragItem>& )
     {
         TQString label;
     
    -    if ( TQTextDrag::decode( evt, label ) ) {
    +    if ( TQTextDrag::decode( evt, label ) ) {
             DDIconViewItem *item = new DDIconViewItem( this, label );
             item->setRenameEnabled( TRUE );
         }
    diff --git a/doc/html/text.html b/doc/html/text.html
    index 190b5db9..94c2b5b5 100644
    --- a/doc/html/text.html
    +++ b/doc/html/text.html
    @@ -49,11 +49,11 @@ body { background: #ffffff; color: black; }
     TQStyleSheetCollection of styles for rich text rendering and a generator of tags
     TQStyleSheetItemEncapsulation of a set of text styles
     TQSyntaxHighlighterBase class for implementing TQTextEdit syntax highlighters
    -TQTextBrowserRich text browser with hypertext navigation
    -TQTextEditPowerful single-page rich text editor
    -TQTextIStreamConvenience class for input streams
    -TQTextOStreamConvenience class for output streams
    -TQTextStreamBasic functions for reading and writing text using a TQIODevice
    +TQTextBrowserRich text browser with hypertext navigation
    +TQTextEditPowerful single-page rich text editor
    +TQTextIStreamConvenience class for input streams
    +TQTextOStreamConvenience class for output streams
    +TQTextStreamBasic functions for reading and writing text using a TQIODevice
     
     
     


    diff --git a/doc/html/titleindex b/doc/html/titleindex index bd60dc30..90760440 100644 --- a/doc/html/titleindex +++ b/doc/html/titleindex @@ -857,28 +857,28 @@ QTableSelection Class | qtableselection.html QTableSelection Member List | qtableselection-members.html QTabletEvent Class | qtabletevent.html QTabletEvent Member List | qtabletevent-members.html -QTextBrowser Class | ntqtextbrowser.html -QTextBrowser Member List | qtextbrowser-members.html -QTextCodec Class | ntqtextcodec.html -QTextCodec Member List | qtextcodec-members.html -QTextCodecPlugin Class | ntqtextcodecplugin.html -QTextCodecPlugin Member List | qtextcodecplugin-members.html -QTextDecoder Class | qtextdecoder.html -QTextDecoder Member List | qtextdecoder-members.html -QTextDrag Class | qtextdrag.html -QTextDrag Member List | qtextdrag-members.html -QTextEdit Class | ntqtextedit.html -QTextEdit Member List | qtextedit-members.html -QTextEncoder Class | qtextencoder.html -QTextEncoder Member List | qtextencoder-members.html -QTextIStream Class | qtextistream.html -QTextIStream Member List | qtextistream-members.html -QTextOStream Class | qtextostream.html -QTextOStream Member List | qtextostream-members.html -QTextStream Class | ntqtextstream.html -QTextStream Member List | qtextstream-members.html -QTextView Class | ntqtextview.html -QTextView Member List | qtextview-members.html +TQTextBrowser Class | tqtextbrowser.html +TQTextBrowser Member List | tqtextbrowser-members.html +TQTextCodec Class | tqtextcodec.html +TQTextCodec Member List | tqtextcodec-members.html +TQTextCodecPlugin Class | tqtextcodecplugin.html +TQTextCodecPlugin Member List | tqtextcodecplugin-members.html +TQTextDecoder Class | tqtextdecoder.html +TQTextDecoder Member List | tqtextdecoder-members.html +TQTextDrag Class | tqtextdrag.html +TQTextDrag Member List | tqtextdrag-members.html +TQTextEdit Class | tqtextedit.html +TQTextEdit Member List | tqtextedit-members.html +TQTextEncoder Class | tqtextencoder.html +TQTextEncoder Member List | tqtextencoder-members.html +TQTextIStream Class | tqtextistream.html +TQTextIStream Member List | tqtextistream-members.html +TQTextOStream Class | tqtextostream.html +TQTextOStream Member List | tqtextostream-members.html +TQTextStream Class | tqtextstream.html +TQTextStream Member List | tqtextstream-members.html +TQTextView Class | tqtextview.html +TQTextView Member List | tqtextview-members.html QThread Class | ntqthread.html QThread Member List | qthread-members.html QThreadStorage Class | ntqthreadstorage.html @@ -1384,12 +1384,12 @@ ntqtabbar.h Include File | qtabbar-h.html ntqtabdialog.h Include File | qtabdialog-h.html ntqtable.h Include File | qtable-h.html ntqtabwidget.h Include File | qtabwidget-h.html -ntqtextbrowser.h Include File | qtextbrowser-h.html -ntqtextcodec.h Include File | qtextcodec-h.html -ntqtextcodecplugin.h Include File | qtextcodecplugin-h.html -ntqtextedit.h Include File | qtextedit-h.html -ntqtextstream.h Include File | qtextstream-h.html -ntqtextview.h Include File | qtextview-h.html +tqtextbrowser.h Include File | tqtextbrowser-h.html +tqtextcodec.h Include File | tqtextcodec-h.html +tqtextcodecplugin.h Include File | tqtextcodecplugin-h.html +tqtextedit.h Include File | tqtextedit-h.html +tqtextstream.h Include File | tqtextstream-h.html +tqtextview.h Include File | tqtextview-h.html ntqthread.h Include File | qthread-h.html ntqthreadstorage.h Include File | qthreadstorage-h.html ntqtimer.h Include File | qtimer-h.html diff --git a/doc/html/tqdomnode.html b/doc/html/tqdomnode.html index 1bf210bf..28217cbd 100644 --- a/doc/html/tqdomnode.html +++ b/doc/html/tqdomnode.html @@ -620,7 +620,7 @@ replaced by all of the children of the fragment.

    Returns a new reference to oldChild on success or a null node an failure.

    See also insertBefore(), insertAfter(), removeChild(), and appendChild(). -

    void TQDomNode::save ( TQTextStream & str, int indent ) const +

    void TQDomNode::save ( TQTextStream & str, int indent ) const

    Writes the XML representation of the node and all its children to the stream str. This function uses indent as the amount of @@ -722,7 +722,7 @@ the returned object will be null.

    See also isText().


    Related Functions

    -

    TQTextStream & operator<< ( TQTextStream & str, const TQDomNode & node ) +

    TQTextStream & operator<< ( TQTextStream & str, const TQDomNode & node )

    Writes the XML representation of the node node and all its diff --git a/doc/html/tqobject.html b/doc/html/tqobject.html index 4a64e20d..c492affa 100644 --- a/doc/html/tqobject.html +++ b/doc/html/tqobject.html @@ -506,13 +506,13 @@ TRUE; otherwise return FALSE. bool eventFilter( TQObject *obj, TQEvent *ev ); private: - TQTextEdit *textEdit; + TQTextEdit *textEdit; }; MyMainWindow::MyMainWindow( TQWidget *parent, const char *name ) : TQMainWindow( parent, name ) { - textEdit = new TQTextEdit( this ); + textEdit = new TQTextEdit( this ); setCentralWidget( textEdit ); textEdit->installEventFilter( this ); } diff --git a/doc/html/tqsqlpropertymap.html b/doc/html/tqsqlpropertymap.html index b762a25e..6202e875 100644 --- a/doc/html/tqsqlpropertymap.html +++ b/doc/html/tqsqlpropertymap.html @@ -130,7 +130,7 @@ new default map.) date TQDateTimeEdit dateTime - TQTextBrowser + TQTextBrowser source TQButton, TQDial, @@ -138,7 +138,7 @@ new default map.) TQLineEdit, TQMultiLineEdit, TQPushButton, -TQTextEdit, +TQTextEdit, text TQTimeEdit time diff --git a/doc/html/tqstring.html b/doc/html/tqstring.html index 865dbdae..353f7216 100644 --- a/doc/html/tqstring.html +++ b/doc/html/tqstring.html @@ -376,7 +376,7 @@ it will result in more readable code. Constructs a string that is a deep copy of str, interpreted as a classic C string. The encoding is assumed to be Latin-1, unless -you change it using TQTextCodec::setCodecForCStrings(). +you change it using TQTextCodec::setCodecForCStrings().

    If str is 0, then a null string is created.

    This is a cast constructor, but it is perfectly safe: converting a Latin-1 const char * to TQString preserves all the information. You @@ -623,7 +623,7 @@ except that the strings are replaced in one pass.

    const char * TQString::ascii () const

    Returns an 8-bit ASCII representation of the string. -

    If a codec has been set using TQTextCodec::codecForCStrings(), +

    If a codec has been set using TQTextCodec::codecForCStrings(), it is used to convert Unicode to 8-bit char. Otherwise, this function does the same as latin1().

    See also fromAscii(), latin1(), utf8(), and local8Bit(). @@ -923,7 +923,7 @@ Returns the Unicode string decoded from the first len bytes of ascii, ignoring the rest of ascii. If len is -1 then the length of ascii is used. If len is bigger than the length of ascii then it will use the length of ascii. -

    If a codec has been set using TQTextCodec::codecForCStrings(), +

    If a codec has been set using TQTextCodec::codecForCStrings(), it is used to convert the string from 8-bit characters to Unicode. Otherwise, this function does the same as fromLatin1().

    This is the same as the TQString(const char*) constructor, but you @@ -958,7 +958,7 @@ of local8Bit.

    local8Bit is assumed to be encoded in a locale-specific format. -

    See TQTextCodec for more diverse coding/decoding of Unicode strings. +

    See TQTextCodec for more diverse coding/decoding of Unicode strings.

    TQString TQString::fromUcs2 ( const unsigned short * str ) [static]

    @@ -978,7 +978,7 @@ the length of utf8 then it will use the length of utf8. // str == "12345"
    -

    See TQTextCodec for more diverse coding/decoding of Unicode strings. +

    See TQTextCodec for more diverse coding/decoding of Unicode strings.

    Example: fonts/simple-qfont-demo/viewer.cpp.

    TQString & TQString::insert ( uint index, const TQString & s ) @@ -1066,7 +1066,7 @@ null string is always empty. Returns a Latin-1 representation of the string. The returned value is undefined if the string contains non-Latin-1 characters. If you want to convert strings into formats other than -Unicode, see the TQTextCodec classes. +Unicode, see the TQTextCodec classes.

    This function is mainly useful for boot-strapping legacy code to use Unicode.

    The result remains valid so long as one unmodified copy of the @@ -1115,10 +1115,10 @@ padded by the fill character.

    TQCString TQString::local8Bit () const

    Returns the string encoded in a locale-specific format. On X11, -this is the TQTextCodec::codecForLocale(). On Windows, it is a +this is the TQTextCodec::codecForLocale(). On Windows, it is a system-defined encoding. On Mac OS X, this always uses UTF-8 as the encoding. -

    See TQTextCodec for more diverse coding/decoding of Unicode +

    See TQTextCodec for more diverse coding/decoding of Unicode strings.

    See also fromLocal8Bit(), ascii(), latin1(), and utf8(). @@ -1131,7 +1131,7 @@ greater than s2.

    The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user. -

    See also TQString::compare() and TQTextCodec::locale(). +

    See also TQString::compare() and TQTextCodec::locale().

    int TQString::localeAwareCompare ( const TQString & s ) const

    @@ -1898,7 +1898,7 @@ the escape sequences of printf() in the standard C library.

    The %s escape sequence expects a utf8() encoded string. The format string cformat is expected to be in latin1. If you need a Unicode format string, use arg() instead. For typesafe string -building, with full Unicode support, you can use TQTextOStream like +building, with full Unicode support, you can use TQTextOStream like this:

             TQString str;
    @@ -2227,7 +2227,7 @@ Returns an uppercase copy of the string.
     

    TQCString TQString::utf8 () const

    Returns the string encoded in UTF-8 format. -

    See TQTextCodec for more diverse coding/decoding of Unicode strings. +

    See TQTextCodec for more diverse coding/decoding of Unicode strings.

    See also fromUtf8(), ascii(), latin1(), and local8Bit().

    Example: network/archivesearch/archivedialog.ui.h. diff --git a/doc/html/tqtextbrowser-h.html b/doc/html/tqtextbrowser-h.html new file mode 100644 index 00000000..badeb3fe --- /dev/null +++ b/doc/html/tqtextbrowser-h.html @@ -0,0 +1,152 @@ + + + + + +tqtextbrowser.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqtextbrowser.h

    + +

    This is the verbatim text of the tqtextbrowser.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqtextbrowser.h   3.3.8   edited Jan 11 14:39 $
    +**
    +** Definition of the TQTextBrowser class
    +**
    +** Created : 990101
    +**
    +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the widgets module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial licenses may use this file in accordance with the TQt
    +** Commercial License Agreement provided with the Software.
    +**
    +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQTEXTBROWSER_H
    +#define TQTEXTBROWSER_H
    +
    +#ifndef QT_H
    +#include "tqptrlist.h"
    +#include "ntqpixmap.h"
    +#include "ntqcolor.h"
    +#include "tqtextedit.h"
    +#endif // QT_H
    +
    +#ifndef TQT_NO_TEXTBROWSER
    +
    +class TQTextBrowserData;
    +
    +class TQ_EXPORT TQTextBrowser : public TQTextEdit
    +{
    +    TQ_OBJECT
    +    TQ_PROPERTY( TQString source READ source WRITE setSource )
    +    TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false )
    +    TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false )
    +    TQ_OVERRIDE( bool modified SCRIPTABLE false)
    +    TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false )
    +    TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false )
    +
    +public:
    +    TQTextBrowser( TQWidget* parent=0, const char* name=0 );
    +    ~TQTextBrowser();
    +
    +    TQString source() const;
    +
    +public slots:
    +    virtual void setSource(const TQString& name);
    +    virtual void backward();
    +    virtual void forward();
    +    virtual void home();
    +    virtual void reload();
    +    void setText( const TQString &txt ) { setText( txt, TQString::null ); }
    +    virtual void setText( const TQString &txt, const TQString &context );
    +
    +signals:
    +    void backwardAvailable( bool );
    +    void forwardAvailable( bool );
    +    void sourceChanged( const TQString& );
    +    void highlighted( const TQString& );
    +    void linkClicked( const TQString& );
    +    void anchorClicked( const TQString&, const TQString& );
    +
    +protected:
    +    void keyPressEvent( TQKeyEvent * e);
    +
    +private:
    +    void popupDetail( const TQString& contents, const TQPoint& pos );
    +    bool linksEnabled() const { return TRUE; }
    +    void emitHighlighted( const TQString &s );
    +    void emitLinkClicked( const TQString &s );
    +    TQTextBrowserData *d;
    +
    +private:	// Disabled copy constructor and operator=
    +#if defined(TQ_DISABLE_COPY)
    +    TQTextBrowser( const TQTextBrowser & );
    +    TQTextBrowser& operator=( const TQTextBrowser & );
    +#endif
    +};
    +
    +#endif // TQT_NO_TEXTBROWSER
    +
    +#endif // TQTEXTBROWSER_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextbrowser-m.png b/doc/html/tqtextbrowser-m.png new file mode 100644 index 00000000..39c1bdb7 Binary files /dev/null and b/doc/html/tqtextbrowser-m.png differ diff --git a/doc/html/tqtextbrowser-members.html b/doc/html/tqtextbrowser-members.html new file mode 100644 index 00000000..c5439fa7 --- /dev/null +++ b/doc/html/tqtextbrowser-members.html @@ -0,0 +1,556 @@ + + + + + +TQTextBrowser Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextBrowser

    + +

    This is the complete list of member functions for +TQTextBrowser, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextbrowser-w.png b/doc/html/tqtextbrowser-w.png new file mode 100644 index 00000000..84343370 Binary files /dev/null and b/doc/html/tqtextbrowser-w.png differ diff --git a/doc/html/tqtextbrowser.html b/doc/html/tqtextbrowser.html new file mode 100644 index 00000000..a1e37938 --- /dev/null +++ b/doc/html/tqtextbrowser.html @@ -0,0 +1,265 @@ + + + + + +TQTextBrowser Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextBrowser Class Reference

    + +

    The TQTextBrowser class provides a rich text browser with hypertext navigation. +More... +

    #include <tqtextbrowser.h> +

    Inherits TQTextEdit. +

    List of all member functions. +

    Public Members

    +
      +
    • TQTextBrowser ( TQWidget * parent = 0, const char * name = 0 )
    • +
    • TQString source () const
    • +
    +

    Public Slots

    + +

    Signals

    + +

    Properties

    +
      +
    • bool modified - whether the contents have been modified  (read only)
    • +
    • bool overwriteMode - this text browser's overwrite mode  (read only)
    • +
    • bool readOnly - whether the contents are read only  (read only)
    • +
    • TQString source - the name of the displayed document
    • +
    • int undoDepth - this text browser's undo depth  (read only)
    • +
    • bool undoRedoEnabled - whether undo and redo are enabled  (read only)
    • +
    +

    Protected Members

    + +

    Detailed Description

    + + +The TQTextBrowser class provides a rich text browser with hypertext navigation. +

    + + + +

    This class extends TQTextEdit (in read-only mode), adding some +navigation functionality so that users can follow links in +hypertext documents. The contents of TQTextEdit is set with +setText(), but TQTextBrowser has an additional function, +setSource(), which makes it possible to set the text to a named +document. The name is looked up in the text view's mime source +factory. If a document name ends with an anchor (for example, "#anchor"), the text browser automatically scrolls to that position +(using scrollToAnchor()). When the user clicks on a hyperlink, the +browser will call setSource() itself, with the link's href +value as argument. You can track the current source by connetion +to the sourceChanged() signal. +

    TQTextBrowser provides backward() and forward() slots which you can +use to implement Back and Forward buttons. The home() slot sets +the text to the very first document displayed. The linkClicked() +signal is emitted when the user clicks a link. +

    By using TQTextEdit::setMimeSourceFactory() you can provide your +own subclass of TQMimeSourceFactory. This makes it possible to +access data from anywhere, for example from a network or from a +database. See TQMimeSourceFactory::data() for details. +

    If you intend using the mime factory to read the data directly +from the file system, you may have to specify the encoding for the +file extension you are using. For example: +

    +    mimeSourceFactory()->setExtensionType("qml", "text/utf8");
    +    
    + +This is to ensure that the factory is able to resolve the document +names. +

    TQTextBrowser interprets the tags it processes in accordance with +the default style sheet. Change the style sheet with +setStyleSheet(); see TQStyleSheet for details. +

    If you want to provide your users with editable rich text use +TQTextEdit. If you want a text browser without hypertext navigation +use TQTextEdit, and use TQTextEdit::setReadOnly() to disable +editing. If you just need to display a small piece of rich text +use TQSimpleRichText or TQLabel. +

    +

    See also Advanced Widgets, Help System, and Text Related Classes. + +


    Member Function Documentation

    +

    TQTextBrowser::TQTextBrowser ( TQWidget * parent = 0, const char * name = 0 ) +

    +Constructs an empty TQTextBrowser called name, with parent parent. + +

    void TQTextBrowser::anchorClicked ( const TQString & name, const TQString & link ) [signal] +

    + +

    This signal is emitted when the user clicks an anchor. The link is +the value of the href i.e. the name of the target document. The name +is the name of the anchor. +

    See also linkClicked(). + +

    void TQTextBrowser::backward () [virtual slot] +

    +Changes the document displayed to the previous document in the +list of documents built by navigating links. Does nothing if there +is no previous document. +

    See also forward() and backwardAvailable(). + +

    Example: helpviewer/helpwindow.cpp. +

    void TQTextBrowser::backwardAvailable ( bool available ) [signal] +

    + +

    This signal is emitted when the availability of backward() +changes. available is FALSE when the user is at home(); +otherwise it is TRUE. + +

    Example: helpviewer/helpwindow.cpp. +

    void TQTextBrowser::forward () [virtual slot] +

    +Changes the document displayed to the next document in the list of +documents built by navigating links. Does nothing if there is no +next document. +

    See also backward() and forwardAvailable(). + +

    Example: helpviewer/helpwindow.cpp. +

    void TQTextBrowser::forwardAvailable ( bool available ) [signal] +

    + +

    This signal is emitted when the availability of forward() changes. +available is TRUE after the user navigates backward() and FALSE +when the user navigates or goes forward(). + +

    Example: helpviewer/helpwindow.cpp. +

    void TQTextBrowser::highlighted ( const TQString & link ) [signal] +

    +

    This signal is emitted when the user has selected but not +activated a link in the document. link is the value of the href i.e. the name of the target document. + +

    Example: helpviewer/helpwindow.cpp. +

    void TQTextBrowser::home () [virtual slot] +

    +Changes the document displayed to be the first document the +browser displayed. + +

    Example: helpviewer/helpwindow.cpp. +

    void TQTextBrowser::keyPressEvent ( TQKeyEvent * e ) [virtual protected] +

    +The event e is used to provide the following keyboard shortcuts: +
    +
    Keypress Action +
    Alt+Left Arrow backward() +
    Alt+Right Arrow forward() +
    Alt+Up Arrow home() +
    + +

    Reimplemented from TQTextEdit. +

    void TQTextBrowser::linkClicked ( const TQString & link ) [signal] +

    + +

    This signal is emitted when the user clicks a link. The link is +the value of the href i.e. the name of the target document. +

    The link will be the absolute location of the document, based +on the value of the anchor's href tag and the current context of +the document. +

    See also anchorClicked() and context(). + +

    void TQTextBrowser::reload () [virtual slot] +

    +Reloads the current set source. + +

    void TQTextBrowser::setSource ( const TQString & name ) [virtual slot] +

    Sets the name of the displayed document to name. +See the "source" property for details. +

    TQString TQTextBrowser::source () const +

    Returns the name of the displayed document. +See the "source" property for details. +

    void TQTextBrowser::sourceChanged ( const TQString & src ) [signal] +

    + +

    This signal is emitted when the mime source has changed, src +being the new source. +

    Source changes happen both programmatically when calling +setSource(), forward(), backword() or home() or when the user +clicks on links or presses the equivalent key sequences. + +

    Example: helpviewer/helpwindow.cpp. +


    Property Documentation

    +

    bool modified

    +

    This property holds whether the contents have been modified. +

    +

    bool overwriteMode

    +

    This property holds this text browser's overwrite mode. +

    +

    bool readOnly

    +

    This property holds whether the contents are read only. +

    +

    TQString source

    +

    This property holds the name of the displayed document. +

    This is a TQString::null if no document is displayed or if the +source is unknown. +

    Setting this property uses the mimeSourceFactory() to lookup the +named document. It also checks for optional anchors and scrolls +the document accordingly. +

    If the first tag in the document is <qt type=detail>, the +document is displayed as a popup rather than as new document in +the browser window itself. Otherwise, the document is displayed +normally in the text browser with the text set to the contents of +the named document with setText(). +

    If you are using the filesystem access capabilities of the mime +source factory, you must ensure that the factory knows about the +encoding of specified files; otherwise no data will be available. +The default factory handles a couple of common file extensions +such as *.html and *.txt with reasonable defaults. See +TQMimeSourceFactory::data() for details. + +

    Set this property's value with setSource() and get this property's value with source(). +

    int undoDepth

    +

    This property holds this text browser's undo depth. +

    +

    bool undoRedoEnabled

    +

    This property holds whether undo and redo are enabled. +

    +

    +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextcodec-h.html b/doc/html/tqtextcodec-h.html new file mode 100644 index 00000000..e912b659 --- /dev/null +++ b/doc/html/tqtextcodec-h.html @@ -0,0 +1,179 @@ + + + + + +tqtextcodec.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqtextcodec.h

    + +

    This is the verbatim text of the tqtextcodec.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqtextcodec.h   3.3.8   edited Jan 11 14:46 $
    +**
    +** Definition of TQTextCodec class
    +**
    +** Created : 981015
    +**
    +** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the tools module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial licenses may use this file in accordance with the TQt
    +** Commercial License Agreement provided with the Software.
    +**
    +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQTEXTCODEC_H
    +#define TQTEXTCODEC_H
    +
    +#ifndef QT_H
    +#include "tqstring.h"
    +#endif // QT_H
    +
    +#ifndef TQT_NO_TEXTCODEC
    +
    +class TQTextCodec;
    +class TQIODevice;
    +class TQFont;
    +
    +class TQ_EXPORT TQTextEncoder {
    +public:
    +    virtual ~TQTextEncoder();
    +    virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) = 0;
    +};
    +
    +class TQ_EXPORT TQTextDecoder {
    +public:
    +    virtual ~TQTextDecoder();
    +    virtual TQString toUnicode(const char* chars, int len) = 0;
    +};
    +
    +class TQ_EXPORT TQTextCodec {
    +public:
    +    virtual ~TQTextCodec();
    +
    +#ifndef TQT_NO_CODECS
    +    static TQTextCodec* loadCharmap(TQIODevice*);
    +    static TQTextCodec* loadCharmapFile(TQString filename);
    +#endif //TQT_NO_CODECS
    +    static TQTextCodec* codecForMib(int mib);
    +    static TQTextCodec* codecForName(const char* hint, int accuracy=0);
    +    static TQTextCodec* codecForContent(const char* chars, int len);
    +    static TQTextCodec* codecForIndex(int i);
    +    static TQTextCodec* codecForLocale();
    +    static void setCodecForLocale(TQTextCodec *c);
    +
    +    static TQTextCodec* codecForTr();
    +    static void setCodecForTr(TQTextCodec *c);
    +    static TQTextCodec* codecForCStrings();
    +    static void setCodecForCStrings(TQTextCodec *c);
    +
    +    static void deleteAllCodecs();
    +
    +    static const char* locale();
    +
    +    virtual const char* name() const = 0;
    +    virtual const char* mimeName() const;
    +    virtual int mibEnum() const = 0;
    +
    +    virtual TQTextDecoder* makeDecoder() const;
    +    virtual TQTextEncoder* makeEncoder() const;
    +
    +    virtual TQString toUnicode(const char* chars, int len) const;
    +    virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) const;
    +
    +    TQCString fromUnicode(const TQString& uc) const;
    +    TQString toUnicode(const TQByteArray&, int len) const;
    +    TQString toUnicode(const TQByteArray&) const;
    +    TQString toUnicode(const TQCString&, int len) const;
    +    TQString toUnicode(const TQCString&) const;
    +    TQString toUnicode(const char* chars) const;
    +    virtual bool canEncode( TQChar ) const;
    +    virtual bool canEncode( const TQString& ) const;
    +
    +    virtual int heuristicContentMatch(const char* chars, int len) const = 0;
    +    virtual int heuristicNameMatch(const char* hint) const;
    +
    +    virtual TQByteArray fromUnicode(const TQString& uc, int from, int len) const;
    +    virtual unsigned short characterFromUnicode(const TQString &str, int pos) const;
    +
    +protected:
    +    TQTextCodec();
    +    static int simpleHeuristicNameMatch(const char* name, const char* hint);
    +
    +private:
    +    friend class TQFont;
    +    friend class TQFontEngineXLFD;
    +    void fromUnicodeInternal( const TQChar *in, unsigned short *out,  int length );
    +
    +    static TQTextCodec *cftr;
    +    static TQTextCodec *cfcs;
    +};
    +
    +inline TQTextCodec* TQTextCodec::codecForTr() { return cftr; }
    +inline void TQTextCodec::setCodecForTr(TQTextCodec *c) { cftr = c; }
    +inline TQTextCodec* TQTextCodec::codecForCStrings() { return cfcs; }
    +inline void TQTextCodec::setCodecForCStrings(TQTextCodec *c) { cfcs = c; }
    +
    +#endif // TQT_NO_TEXTCODEC
    +#endif // TQTEXTCODEC_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextcodec-members.html b/doc/html/tqtextcodec-members.html new file mode 100644 index 00000000..ecca7c61 --- /dev/null +++ b/doc/html/tqtextcodec-members.html @@ -0,0 +1,73 @@ + + + + + +TQTextCodec Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextCodec

    + +

    This is the complete list of member functions for +TQTextCodec, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextcodec.html b/doc/html/tqtextcodec.html new file mode 100644 index 00000000..bce967c6 --- /dev/null +++ b/doc/html/tqtextcodec.html @@ -0,0 +1,611 @@ + + + + + +TQTextCodec Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextCodec Class Reference

    + +

    The TQTextCodec class provides conversion between text encodings. +More... +

    Almost all the functions in this class are reentrant when TQt is built with thread support. The exceptions are ~TQTextCodec(), setCodecForTr(), setCodecForCStrings(), and TQTextCodec(). +

    #include <tqtextcodec.h> +

    Inherited by TQBig5Codec, TQBig5hkscsCodec, TQEucJpCodec, TQEucKrCodec, TQGb18030Codec, TQJisCodec, TQHebrewCodec, TQSjisCodec, and TQTsciiCodec. +

    List of all member functions. +

    Public Members

    +
      +
    • virtual ~TQTextCodec ()
    • +
    • virtual const char * name () const = 0
    • +
    • virtual const char * mimeName () const
    • +
    • virtual int mibEnum () const = 0
    • +
    • virtual TQTextDecoder * makeDecoder () const
    • +
    • virtual TQTextEncoder * makeEncoder () const
    • +
    • virtual TQString toUnicode ( const char * chars, int len ) const
    • +
    • virtual TQCString fromUnicode ( const TQString & uc, int & lenInOut ) const
    • +
    • TQCString fromUnicode ( const TQString & uc ) const
    • +
    • TQString toUnicode ( const TQByteArray & a, int len ) const
    • +
    • TQString toUnicode ( const TQByteArray & a ) const
    • +
    • TQString toUnicode ( const TQCString & a, int len ) const
    • +
    • TQString toUnicode ( const TQCString & a ) const
    • +
    • TQString toUnicode ( const char * chars ) const
    • +
    • virtual bool canEncode ( TQChar ch ) const
    • +
    • virtual bool canEncode ( const TQString & s ) const
    • +
    • virtual int heuristicContentMatch ( const char * chars, int len ) const = 0
    • +
    • virtual int heuristicNameMatch ( const char * hint ) const
    • +
    +

    Static Public Members

    + +

    Protected Members

    + +

    Static Protected Members

    + +

    Detailed Description

    + + +The TQTextCodec class provides conversion between text encodings. + + +

    TQt uses Unicode to store, draw and manipulate strings. In many +situations you may wish to deal with data that uses a different +encoding. For example, most Japanese documents are still stored in +Shift-JIS or ISO2022, while Russian users often have their +documents in KOI8-R or CP1251. +

    TQt provides a set of TQTextCodec classes to help with converting +non-Unicode formats to and from Unicode. You can also create your +own codec classes (see later). +

    The supported encodings are: +

      +
    • Latin1 +
    • Big5 -- Chinese +
    • Big5-HKSCS -- Chinese +
    • eucJP -- Japanese +
    • eucKR -- Korean +
    • GB2312 -- Chinese +
    • GBK -- Chinese +
    • GB18030 -- Chinese +
    • JIS7 -- Japanese +
    • Shift-JIS -- Japanese +
    • TSCII -- Tamil +
    • utf8 -- Unicode, 8-bit +
    • utf16 -- Unicode +
    • KOI8-R -- Russian +
    • KOI8-U -- Ukrainian +
    • ISO8859-1 -- Western +
    • ISO8859-2 -- Central European +
    • ISO8859-3 -- Central European +
    • ISO8859-4 -- Baltic +
    • ISO8859-5 -- Cyrillic +
    • ISO8859-6 -- Arabic +
    • ISO8859-7 -- Greek +
    • ISO8859-8 -- Hebrew, visually ordered +
    • ISO8859-8-i -- Hebrew, logically ordered +
    • ISO8859-9 -- Turkish +
    • ISO8859-10 +
    • ISO8859-13 +
    • ISO8859-14 +
    • ISO8859-15 -- Western +
    • IBM 850 +
    • IBM 866 +
    • CP874 +
    • CP1250 -- Central European +
    • CP1251 -- Cyrillic +
    • CP1252 -- Western +
    • CP1253 -- Greek +
    • CP1254 -- Turkish +
    • CP1255 -- Hebrew +
    • CP1256 -- Arabic +
    • CP1257 -- Baltic +
    • CP1258 +
    • Apple Roman +
    • TIS-620 -- Thai +
    +

    TQTextCodecs can be used as follows to convert some locally encoded +string to Unicode. Suppose you have some string encoded in Russian +KOI8-R encoding, and want to convert it to Unicode. The simple way +to do this is: +

    +    TQCString locallyEncoded = "..."; // text to convert
    +    TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R
    +    TQString unicodeString = codec->toUnicode( locallyEncoded );
    +    
    + +

    After this, unicodeString holds the text converted to Unicode. +Converting a string from Unicode to the local encoding is just as +easy: +

    +    TQString unicodeString = "..."; // any Unicode text
    +    TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R
    +    TQCString locallyEncoded = codec->fromUnicode( unicodeString );
    +    
    + +

    Some care must be taken when trying to convert the data in chunks, +for example, when receiving it over a network. In such cases it is +possible that a multi-byte character will be split over two +chunks. At best this might result in the loss of a character and +at worst cause the entire conversion to fail. +

    The approach to use in these situations is to create a TQTextDecoder +object for the codec and use this TQTextDecoder for the whole +decoding process, as shown below: +

    +    TQTextCodec *codec = TQTextCodec::codecForName( "Shift-JIS" );
    +    TQTextDecoder *decoder = codec->makeDecoder();
    +
    +    TQString unicodeString;
    +    while( receiving_data ) {
    +        TQByteArray chunk = new_data;
    +        unicodeString += decoder->toUnicode( chunk.data(), chunk.length() );
    +    }
    +    
    + +

    The TQTextDecoder object maintains state between chunks and therefore +works correctly even if a multi-byte character is split between +chunks. +

    +

    Creating your own Codec class +

    +

    Support for new text encodings can be added to TQt by creating +TQTextCodec subclasses. +

    Built-in codecs can be overridden by custom codecs since more +recently created TQTextCodec objects take precedence over earlier +ones. +

    You may find it more convenient to make your codec class available +as a plugin; see the plugin + documentation for more details. +

    The abstract virtual functions describe the encoder to the +system and the coder is used as required in the different +text file formats supported by TQTextStream, and under X11, for the +locale-specific character input and output. +

    To add support for another 8-bit encoding to TQt, make a subclass +of TQTextCodec and implement at least the following methods: +

    +    const char* name() const
    +    
    + +Return the official name for the encoding. +

    +    int mibEnum() const
    +    
    + +Return the MIB enum for the encoding if it is listed in the +IANA character-sets encoding file. +

    If the encoding is multi-byte then it will have "state"; that is, +the interpretation of some bytes will be dependent on some preceding +bytes. For such encodings, you must implement: +

    +    TQTextDecoder* makeDecoder() const
    +    
    + +Return a TQTextDecoder that remembers incomplete multi-byte sequence +prefixes or other required state. +

    If the encoding does not require state, you should implement: +

    +    TQString toUnicode(const char* chars, int len) const
    +    
    + +Converts len characters from chars to Unicode. +

    The base TQTextCodec class has default implementations of the above +two functions, but they are mutually recursive, so you must +re-implement at least one of them, or both for improved efficiency. +

    For conversion from Unicode to 8-bit encodings, it is rarely necessary +to maintain state. However, two functions similar to the two above +are used for encoding: +

    +    TQTextEncoder* makeEncoder() const
    +    
    + +Return a TQTextEncoder. +

    +    TQCString fromUnicode(const TQString& uc, int& lenInOut ) const
    +    
    + +Converts lenInOut characters (of type TQChar) from the start of +the string uc, returning a TQCString result, and also returning +the length of the result in +lenInOut. +

    Again, these are mutually recursive so only one needs to be implemented, +or both if greater efficiency is possible. +

    Finally, you must implement: +

    +    int heuristicContentMatch(const char* chars, int len) const
    +    
    + +Gives a value indicating how likely it is that len characters +from chars are in the encoding. +

    A good model for this function is the +TQWindowsLocalCodec::heuristicContentMatch function found in the TQt +sources. +

    A TQTextCodec subclass might have improved performance if you also +re-implement: +

    +    bool canEncode( TQChar ) const
    +    
    + +Test if a Unicode character can be encoded. +

    +    bool canEncode( const TQString& ) const
    +    
    + +Test if a string of Unicode characters can be encoded. +

    +    int heuristicNameMatch(const char* hint) const
    +    
    + +Test if a possibly non-standard name is referring to the codec. +

    Codecs can also be created as plugins. +

    See also Internationalization with TQt. + +


    Member Function Documentation

    +

    TQTextCodec::TQTextCodec () [protected] +

    Warning: This function is not reentrant.

    + + +

    Constructs a TQTextCodec, and gives it the highest precedence. The +TQTextCodec should always be constructed on the heap (i.e. with new). TQt takes ownership and will delete it when the application +terminates. + +

    TQTextCodec::~TQTextCodec () [virtual] +

    Warning: This function is not reentrant.

    + + +

    Destroys the TQTextCodec. Note that you should not delete codecs +yourself: once created they become TQt's responsibility. + +

    bool TQTextCodec::canEncode ( TQChar ch ) const [virtual] +

    +Returns TRUE if the Unicode character ch can be fully encoded +with this codec; otherwise returns FALSE. The default +implementation tests if the result of toUnicode(fromUnicode(ch)) +is the original ch. Subclasses may be able to improve the +efficiency. + +

    bool TQTextCodec::canEncode ( const TQString & s ) const [virtual] +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    s contains the string being tested for encode-ability. + +

    TQTextCodec * TQTextCodec::codecForCStrings () [static] +

    + +

    Returns the codec used by TQString to convert to and from const +char* and TQCStrings. If this function returns 0 (the default), +TQString assumes Latin-1. +

    See also setCodecForCStrings(). + +

    TQTextCodec * TQTextCodec::codecForContent ( const char * chars, int len ) [static] +

    +Searches all installed TQTextCodec objects, returning the one which +most recognizes the given content. May return 0. +

    Note that this is often a poor choice, since character encodings +often use most of the available character sequences, and so only +by linguistic analysis could a true match be made. +

    chars contains the string to check, and len contains the +number of characters in the string to use. +

    See also heuristicContentMatch(). + +

    Example: qwerty/qwerty.cpp. +

    TQTextCodec * TQTextCodec::codecForIndex ( int i ) [static] +

    +Returns the TQTextCodec i positions from the most recently +inserted codec, or 0 if there is no such TQTextCodec. Thus, +codecForIndex(0) returns the most recently created TQTextCodec. + +

    Example: qwerty/qwerty.cpp. +

    TQTextCodec * TQTextCodec::codecForLocale () [static] +

    Returns a pointer to the codec most suitable for this locale. +

    Example: qwerty/qwerty.cpp. +

    TQTextCodec * TQTextCodec::codecForMib ( int mib ) [static] +

    +Returns the TQTextCodec which matches the MIBenum mib. + +

    TQTextCodec * TQTextCodec::codecForName ( const char * name, int accuracy = 0 ) [static] +

    +Searches all installed TQTextCodec objects and returns the one +which best matches name; the match is case-insensitive. Returns +0 if no codec's heuristicNameMatch() reports a match better than +accuracy, or if name is a null string. +

    See also heuristicNameMatch(). + +

    TQTextCodec * TQTextCodec::codecForTr () [static] +

    + +

    Returns the codec used by TQObject::tr() on its argument. If this +function returns 0 (the default), tr() assumes Latin-1. +

    See also setCodecForTr(). + +

    void TQTextCodec::deleteAllCodecs () [static] +

    +Deletes all the created codecs. +

    Warning: Do not call this function. +

    TQApplication calls this function just before exiting to delete +any TQTextCodec objects that may be lying around. Since various +other classes hold pointers to TQTextCodec objects, it is not safe +to call this function earlier. +

    If you are using the utility classes (like TQString) but not using +TQApplication, calling this function at the very end of your +application may be helpful for chasing down memory leaks by +eliminating any TQTextCodec objects. + +

    TQCString TQTextCodec::fromUnicode ( const TQString & uc, int & lenInOut ) const [virtual] +

    +TQTextCodec subclasses must reimplement either this function or +makeEncoder(). It converts the first lenInOut characters of uc from Unicode to the encoding of the subclass. If lenInOut is +negative or too large, the length of uc is used instead. +

    Converts lenInOut characters (not bytes) from uc, producing +a TQCString. lenInOut will be set to the length of the result (in bytes). +

    The default implementation makes an encoder with makeEncoder() and +converts the input with that. Note that the default makeEncoder() +implementation makes an encoder that simply calls this function, +hence subclasses must reimplement one function or the other to +avoid infinite recursion. + +

    Reimplemented in TQHebrewCodec. +

    TQCString TQTextCodec::fromUnicode ( const TQString & uc ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    uc is the unicode source string. + +

    int TQTextCodec::heuristicContentMatch ( const char * chars, int len ) const [pure virtual] +

    + +

    TQTextCodec subclasses must reimplement this function. It examines +the first len bytes of chars and returns a value indicating +how likely it is that the string is a prefix of text encoded in +the encoding of the subclass. A negative return value indicates +that the text is detectably not in the encoding (e.g. it contains +characters undefined in the encoding). A return value of 0 +indicates that the text should be decoded with this codec rather +than as ASCII, but there is no particular evidence. The value +should range up to len. Thus, most decoders will return -1, 0, +or -len. +

    The characters are not null terminated. +

    See also codecForContent(). + +

    int TQTextCodec::heuristicNameMatch ( const char * hint ) const [virtual] +

    +Returns a value indicating how likely it is that this decoder is +appropriate for decoding some format that has the given name. The +name is compared with the hint. +

    A good match returns a positive number around the length of the +string. A bad match is negative. +

    The default implementation calls simpleHeuristicNameMatch() with +the name of the codec. + +

    TQTextCodec * TQTextCodec::loadCharmap ( TQIODevice * iod ) [static] +

    +Reads a POSIX2 charmap definition from iod. +The parser recognizes the following lines: +

    +  <code_set_name> name
    +  <escape_char> character
    +  % alias alias
    +  CHARMAP
    +  <token> /xhexbyte <Uunicode> ...
    +  <token> /ddecbyte <Uunicode> ...
    +  <token> /octbyte <Uunicode> ...
    +  <token> /any/any... <Uunicode> ...
    +  END CHARMAP
    +
    +

    The resulting TQTextCodec is returned (and also added to the global +list of codecs). The name() of the result is taken from the +code_set_name. +

    Note that a codec constructed in this way uses much more memory +and is slower than a hand-written TQTextCodec subclass, since +tables in code are kept in memory shared by all TQt applications. +

    See also loadCharmapFile(). + +

    Example: qwerty/qwerty.cpp. +

    TQTextCodec * TQTextCodec::loadCharmapFile ( TQString filename ) [static] +

    +A convenience function for loadCharmap() that loads the charmap +definition from the file filename. + +

    const char * TQTextCodec::locale () [static] +

    +Returns a string representing the current language and +sublanguage, e.g. "pt" for Portuguese, or "pt_br" for Portuguese/Brazil. + +

    Example: i18n/main.cpp. +

    TQTextDecoder * TQTextCodec::makeDecoder () const [virtual] +

    +Creates a TQTextDecoder which stores enough state to decode chunks +of char* data to create chunks of Unicode data. The default +implementation creates a stateless decoder, which is only +sufficient for the simplest encodings where each byte corresponds +to exactly one Unicode character. +

    The caller is responsible for deleting the returned object. + +

    TQTextEncoder * TQTextCodec::makeEncoder () const [virtual] +

    +Creates a TQTextEncoder which stores enough state to encode chunks +of Unicode data as char* data. The default implementation creates +a stateless encoder, which is only sufficient for the simplest +encodings where each Unicode character corresponds to exactly one +character. +

    The caller is responsible for deleting the returned object. + +

    int TQTextCodec::mibEnum () const [pure virtual] +

    + +

    Subclasses of TQTextCodec must reimplement this function. It +returns the MIBenum (see the + IANA character-sets encoding file for more information). +It is important that each TQTextCodec subclass returns the correct +unique value for this function. + +

    Reimplemented in TQEucJpCodec. +

    const char * TQTextCodec::mimeName () const [virtual] +

    +Returns the preferred mime name of the encoding as defined in the +IANA character-sets encoding file. + +

    Reimplemented in TQEucJpCodec, TQEucKrCodec, TQJisCodec, TQHebrewCodec, and TQSjisCodec. +

    const char * TQTextCodec::name () const [pure virtual] +

    + +

    TQTextCodec subclasses must reimplement this function. It returns +the name of the encoding supported by the subclass. When choosing +a name for an encoding, consider these points: +

      +
    • On X11, heuristicNameMatch( const char * hint ) +is used to test if a the TQTextCodec +can convert between Unicode and the encoding of a font +with encoding hint, such as "iso8859-1" for Latin-1 fonts, +"koi8-r" for Russian KOI8 fonts. +The default algorithm of heuristicNameMatch() uses name(). +
    • Some applications may use this function to present +encodings to the end user. +
    + +

    Example: qwerty/qwerty.cpp. +

    void TQTextCodec::setCodecForCStrings ( TQTextCodec * c ) [static] +

    Warning: This function is not reentrant.

    + + + +

    Sets the codec used by TQString to convert to and from const char* +and TQCStrings. If c is 0 (the default), TQString assumes Latin-1. +

    Warning: Some codecs do not preserve the characters in the ascii +range (0x00 to 0x7f). For example, the Japanese Shift-JIS +encoding maps the backslash character (0x5a) to the Yen character. +This leads to unexpected results when using the backslash +character to escape characters in strings used in e.g. regular +expressions. Use TQString::fromLatin1() to preserve characters in +the ascii range when needed. +

    See also codecForCStrings() and setCodecForTr(). + +

    void TQTextCodec::setCodecForLocale ( TQTextCodec * c ) [static] +

    +Set the codec to c; this will be returned by codecForLocale(). +This might be needed for some applications that want to use their +own mechanism for setting the locale. +

    See also codecForLocale(). + +

    void TQTextCodec::setCodecForTr ( TQTextCodec * c ) [static] +

    Warning: This function is not reentrant.

    + + + +

    Sets the codec used by TQObject::tr() on its argument to c. If +c is 0 (the default), tr() assumes Latin-1. +

    If the literal quoted text in the program is not in the Latin-1 +encoding, this function can be used to set the appropriate +encoding. For example, software developed by Korean programmers +might use eucKR for all the text in the program, in which case the +main() function might look like this: +

    +    int main(int argc, char** argv)
    +    {
    +        TQApplication app(argc, argv);
    +        ... install any additional codecs ...
    +        TQTextCodec::setCodecForTr( TQTextCodec::codecForName("eucKR") );
    +        ...
    +    }
    +    
    + +

    Note that this is not the way to select the encoding that the user has chosen. For example, to convert an application containing +literal English strings to Korean, all that is needed is for the +English strings to be passed through tr() and for translation +files to be loaded. For details of internationalization, see the +TQt internationalization documentation. +

    See also codecForTr() and setCodecForCStrings(). + +

    int TQTextCodec::simpleHeuristicNameMatch ( const char * name, const char * hint ) [static protected] +

    +A simple utility function for heuristicNameMatch(): it does some +very minor character-skipping so that almost-exact matches score +high. name is the text we're matching and hint is used for +the comparison. + +

    TQString TQTextCodec::toUnicode ( const char * chars, int len ) const [virtual] +

    +TQTextCodec subclasses must reimplement this function or +makeDecoder(). It converts the first len characters of chars +to Unicode. +

    The default implementation makes a decoder with makeDecoder() and +converts the input with that. Note that the default makeDecoder() +implementation makes a decoder that simply calls +this function, hence subclasses must reimplement one function or +the other to avoid infinite recursion. + +

    TQString TQTextCodec::toUnicode ( const TQByteArray & a, int len ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    a contains the source characters; len contains the number of +characters in a to use. + +

    TQString TQTextCodec::toUnicode ( const TQByteArray & a ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    a contains the source characters. + +

    TQString TQTextCodec::toUnicode ( const TQCString & a, int len ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    a contains the source characters; len contains the number of +characters in a to use. + +

    TQString TQTextCodec::toUnicode ( const TQCString & a ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    a contains the source characters. + +

    TQString TQTextCodec::toUnicode ( const char * chars ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    chars contains the source characters. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextcodecplugin-h.html b/doc/html/tqtextcodecplugin-h.html new file mode 100644 index 00000000..1e717620 --- /dev/null +++ b/doc/html/tqtextcodecplugin-h.html @@ -0,0 +1,115 @@ + + + + + +tqtextcodecplugin.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqtextcodecplugin.h

    + +

    This is the verbatim text of the tqtextcodecplugin.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqtextcodecplugin.h   3.3.8   edited Jan 11 14:46 $
    +**
    +** Definition of TQTextCodecPlugin class
    +**
    +** Created : 010920
    +**
    +** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the tools module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial licenses may use this file in accordance with the TQt
    +** Commercial License Agreement provided with the Software.
    +**
    +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQTEXTCODECPLUGIN_H
    +#define TQTEXTCODECPLUGIN_H
    +
    +#ifndef QT_H
    +#include "ntqgplugin.h"
    +#include "tqstringlist.h"
    +#endif // QT_H
    +
    +#ifndef TQT_NO_TEXTCODECPLUGIN
    +class TQTextCodec;
    +class TQTextCodecPluginPrivate;
    +
    +class TQ_EXPORT TQTextCodecPlugin : public TQGPlugin
    +{
    +    TQ_OBJECT
    +public:
    +    TQTextCodecPlugin();
    +    ~TQTextCodecPlugin();
    +
    +    virtual TQStringList names() const = 0;
    +    virtual TQTextCodec *createForName( const TQString &name ) = 0;
    +    
    +    virtual TQValueList<int> mibEnums() const = 0;
    +    virtual TQTextCodec *createForMib( int mib ) = 0;
    +
    +private:
    +    TQTextCodecPluginPrivate *d;
    +};
    +#endif // TQT_NO_TEXTCODECPLUGIN
    +#endif // TQTEXTCODECPLUGIN_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextcodecplugin-members.html b/doc/html/tqtextcodecplugin-members.html new file mode 100644 index 00000000..a5121af8 --- /dev/null +++ b/doc/html/tqtextcodecplugin-members.html @@ -0,0 +1,52 @@ + + + + + +TQTextCodecPlugin Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextCodecPlugin

    + +

    This is the complete list of member functions for +TQTextCodecPlugin, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextcodecplugin.html b/doc/html/tqtextcodecplugin.html new file mode 100644 index 00000000..274af80d --- /dev/null +++ b/doc/html/tqtextcodecplugin.html @@ -0,0 +1,114 @@ + + + + + +TQTextCodecPlugin Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextCodecPlugin Class Reference

    + +

    The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. +More... +

    All the functions in this class are reentrant when TQt is built with thread support.

    +

    #include <tqtextcodecplugin.h> +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + +The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. + + +

    The text codec plugin is a simple plugin interface that makes it +easy to create custom text codecs that can be loaded dynamically +into applications. +

    Writing a text codec plugin is achieved by subclassing this base +class, reimplementing the pure virtual functions names(), +createForName(), mibEnums() and createForMib(), and exporting the +class with the TQ_EXPORT_PLUGIN macro. See the TQt Plugins documentation for details. +

    See the IANA + character-sets encoding file for more information on mime +names and mib enums. +

    See also Plugins. + +


    Member Function Documentation

    +

    TQTextCodecPlugin::TQTextCodecPlugin () +

    +Constructs a text codec plugin. This is invoked automatically by +the TQ_EXPORT_PLUGIN macro. + +

    TQTextCodecPlugin::~TQTextCodecPlugin () +

    +Destroys the text codec plugin. +

    You never have to call this explicitly. TQt destroys a plugin +automatically when it is no longer used. + +

    TQTextCodec * TQTextCodecPlugin::createForMib ( int mib ) [pure virtual] +

    + +

    Creates a TQTextCodec object for the mib enum mib. +

    (See the + IANA character-sets encoding file for more information) +

    See also mibEnums(). + +

    TQTextCodec * TQTextCodecPlugin::createForName ( const TQString & name ) [pure virtual] +

    + +

    Creates a TQTextCodec object for the codec called name. +

    See also names(). + +

    TQValueList<int> TQTextCodecPlugin::mibEnums () const [pure virtual] +

    + +

    Returns the list of mib enums supported by this plugin. +

    See also createForMib(). + +

    TQStringList TQTextCodecPlugin::names () const [pure virtual] +

    + +

    Returns the list of mime names supported by this plugin. +

    See also createForName(). + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextdecoder-members.html b/doc/html/tqtextdecoder-members.html new file mode 100644 index 00000000..cc29254f --- /dev/null +++ b/doc/html/tqtextdecoder-members.html @@ -0,0 +1,48 @@ + + + + + +TQTextDecoder Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextDecoder

    + +

    This is the complete list of member functions for +TQTextDecoder, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextdecoder.html b/doc/html/tqtextdecoder.html new file mode 100644 index 00000000..46c43708 --- /dev/null +++ b/doc/html/tqtextdecoder.html @@ -0,0 +1,78 @@ + + + + + +TQTextDecoder Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextDecoder Class Reference

    + +

    The TQTextDecoder class provides a state-based decoder. +More... +

    All the functions in this class are reentrant when TQt is built with thread support.

    +

    #include <tqtextcodec.h> +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + +The TQTextDecoder class provides a state-based decoder. + + +

    The decoder converts a text format into Unicode, remembering any +state that is required between calls. +

    See also TQTextCodec::makeEncoder() and Internationalization with TQt. + +


    Member Function Documentation

    +

    TQTextDecoder::~TQTextDecoder () [virtual] +

    +Destroys the decoder. + +

    TQString TQTextDecoder::toUnicode ( const char * chars, int len ) [pure virtual] +

    + +

    Converts the first len bytes in chars to Unicode, returning +the result. +

    If not all characters are used (e.g. if only part of a multi-byte +encoding is at the end of the characters), the decoder remembers +enough state to continue with the next call to this function. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextdrag-members.html b/doc/html/tqtextdrag-members.html new file mode 100644 index 00000000..88c21659 --- /dev/null +++ b/doc/html/tqtextdrag-members.html @@ -0,0 +1,107 @@ + + + + + +TQTextDrag Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextDrag

    + +

    This is the complete list of member functions for +TQTextDrag, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextdrag.html b/doc/html/tqtextdrag.html new file mode 100644 index 00000000..d8fa395a --- /dev/null +++ b/doc/html/tqtextdrag.html @@ -0,0 +1,129 @@ + + + + + +TQTextDrag Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextDrag Class Reference

    + +

    The TQTextDrag class is a drag and drop object for +transferring plain and Unicode text. +More... +

    #include <ntqdragobject.h> +

    Inherits TQDragObject. +

    List of all member functions. +

    Public Members

    +
      +
    • TQTextDrag ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 )
    • +
    • TQTextDrag ( TQWidget * dragSource = 0, const char * name = 0 )
    • +
    • ~TQTextDrag ()
    • +
    • virtual void setText ( const TQString & text )
    • +
    • virtual void setSubtype ( const TQCString & st )
    • +
    +

    Static Public Members

    +
      +
    • bool canDecode ( const TQMimeSource * e )
    • +
    • bool decode ( const TQMimeSource * e, TQString & str )
    • +
    • bool decode ( const TQMimeSource * e, TQString & str, TQCString & subtype )
    • +
    +

    Detailed Description

    + + +

    The TQTextDrag class is a drag and drop object for +transferring plain and Unicode text. +

    +

    Plain text is passed in a TQString which may contain multiple lines +(i.e. may contain newline characters). The drag target will receive +the newlines according to the runtime environment, e.g. LF on Unix, +and CRLF on Windows. +

    TQt provides no built-in mechanism for delivering only a single-line. +

    For more information about drag and drop, see the TQDragObject class +and the drag and drop documentation. +

    See also Drag And Drop Classes. + +


    Member Function Documentation

    +

    TQTextDrag::TQTextDrag ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 ) +

    +Constructs a text drag object and sets its data to text. dragSource must be the drag source; name is the object name. + +

    TQTextDrag::TQTextDrag ( TQWidget * dragSource = 0, const char * name = 0 ) +

    +Constructs a default text drag object. dragSource must be the +drag source; name is the object name. + +

    TQTextDrag::~TQTextDrag () +

    +Destroys the text drag object and frees up all allocated +resources. + +

    bool TQTextDrag::canDecode ( const TQMimeSource * e ) [static] +

    +Returns TRUE if the information in e can be decoded into a +TQString; otherwise returns FALSE. +

    See also decode(). + +

    Example: iconview/simple_dd/main.cpp. +

    bool TQTextDrag::decode ( const TQMimeSource * e, TQString & str ) [static] +

    +Attempts to decode the dropped information in e into str. +Returns TRUE if successful; otherwise returns FALSE. +

    See also canDecode(). + +

    Example: iconview/simple_dd/main.cpp. +

    bool TQTextDrag::decode ( const TQMimeSource * e, TQString & str, TQCString & subtype ) [static] +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Attempts to decode the dropped information in e into str. +Returns TRUE if successful; otherwise returns FALSE. If subtype +is null, any text subtype is accepted; otherwise only the +specified subtype is accepted. +

    See also canDecode(). + +

    void TQTextDrag::setSubtype ( const TQCString & st ) [virtual] +

    +Sets the MIME subtype of the text being dragged to st. The +default subtype is "plain", so the default MIME type of the text +is "text/plain". You might use this to declare that the text is +"text/html" by calling setSubtype("html"). + +

    void TQTextDrag::setText ( const TQString & text ) [virtual] +

    +Sets the text to be dragged to text. You will need to call this +if you did not pass the text during construction. + + +

    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextedit-h.html b/doc/html/tqtextedit-h.html new file mode 100644 index 00000000..94375129 --- /dev/null +++ b/doc/html/tqtextedit-h.html @@ -0,0 +1,655 @@ + + + + + +tqtextedit.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqtextedit.h

    + +

    This is the verbatim text of the tqtextedit.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqtextedit.h   3.3.8   edited Jan 11 14:39 $
    +**
    +** Definition of the TQTextEdit class
    +**
    +** Created : 990101
    +**
    +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the widgets module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial licenses may use this file in accordance with the TQt
    +** Commercial License Agreement provided with the Software.
    +**
    +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQTEXTEDIT_H
    +#define TQTEXTEDIT_H
    +
    +#ifndef QT_H
    +#include "ntqscrollview.h"
    +#include "ntqstylesheet.h"
    +#include "tqptrvector.h"
    +#include "tqvaluelist.h"
    +#include "tqptrlist.h"
    +#endif // QT_H
    +
    +#ifndef TQT_NO_TEXTEDIT
    +// uncomment below to enable optimization mode - also uncomment the
    +// optimDoAutoScroll() private slot since moc ignores #ifdefs..
    +#define QT_TEXTEDIT_OPTIMIZATION
    +
    +class TQPainter;
    +class TQTextDocument;
    +class TQTextCursor;
    +class TQKeyEvent;
    +class TQResizeEvent;
    +class TQMouseEvent;
    +class TQTimer;
    +class TQTextString;
    +class TQTextCommand;
    +class TQTextParagraph;
    +class TQTextFormat;
    +class TQFont;
    +class TQColor;
    +class TQTextEdit;
    +class TQTextBrowser;
    +class TQTextString;
    +struct TQUndoRedoInfoPrivate;
    +class TQPopupMenu;
    +class TQTextEditPrivate;
    +class TQSyntaxHighlighter;
    +
    +#ifdef QT_TEXTEDIT_OPTIMIZATION
    +class TQTextEditOptimPrivate
    +{
    +public:
    +    // Note: no left-tag has any value for leftTag or parent, and
    +    // no right-tag has any formatting flags set.
    +    enum TagType { Color = 0, Format = 1 };
    +    struct Tag {
    +	TagType type:2;
    +	bool bold:1;
    +	bool italic:1;
    +	bool underline:1;
    +	int line;
    +	int index;
    +	Tag * leftTag; // ptr to left-tag in a left-right tag pair
    +	Tag * parent;  // ptr to parent left-tag in a nested tag
    +	Tag * prev;
    +	Tag * next;
    +	TQString tag;
    +    };
    +    TQTextEditOptimPrivate()
    +    {
    +	len = numLines = maxLineWidth = 0;
    +	selStart.line = selStart.index = -1;
    +	selEnd.line = selEnd.index = -1;
    +	search.line = search.index = 0;
    +	tags = lastTag = 0;
    +    }
    +    void clearTags()
    +    {
    +	Tag * itr = tags;
    +	while ( tags ) {
    +	    itr  = tags;
    +	    tags = tags->next;
    +	    delete itr;
    +	}
    +	tags = lastTag = 0;
    +	tagIndex.clear();
    +    }
    +    ~TQTextEditOptimPrivate()
    +    {
    +	clearTags();
    +    }
    +    int len;
    +    int numLines;
    +    int maxLineWidth;
    +    struct Selection {
    +	int line;
    +	int index;
    +    };
    +    Selection selStart, selEnd, search;
    +    Tag * tags, * lastTag;
    +    TQMap<int, TQString> lines;
    +    TQMap<int, Tag *> tagIndex;
    +};
    +#endif
    +
    +class TQ_EXPORT TQTextEdit : public TQScrollView
    +{
    +    friend class TQTextBrowser;
    +    friend class TQSyntaxHighlighter;
    +
    +    TQ_OBJECT
    +    TQ_ENUMS( WordWrap WrapPolicy )
    +    TQ_SETS( AutoFormatting )
    +    TQ_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat )
    +    TQ_PROPERTY( TQString text READ text WRITE setText )
    +    TQ_PROPERTY( TQBrush paper READ paper WRITE setPaper )
    +    TQ_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline )
    +    TQ_PROPERTY( TQString documentTitle READ documentTitle )
    +    TQ_PROPERTY( int length READ length )
    +    TQ_PROPERTY( WordWrap wordWrap READ wordWrap WRITE setWordWrap )
    +    TQ_PROPERTY( int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth )
    +    TQ_PROPERTY( WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy )
    +    TQ_PROPERTY( bool hasSelectedText READ hasSelectedText )
    +    TQ_PROPERTY( TQString selectedText READ selectedText )
    +    TQ_PROPERTY( int undoDepth READ undoDepth WRITE setUndoDepth )
    +    TQ_PROPERTY( bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode )
    +    TQ_PROPERTY( bool modified READ isModified WRITE setModified DESIGNABLE false )
    +    TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
    +    TQ_PROPERTY( bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled )
    +    TQ_PROPERTY( int tabStopWidth READ tabStopWidth WRITE setTabStopWidth )
    +    TQ_PROPERTY( bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus )
    +    TQ_PROPERTY( AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting )
    +
    +public:
    +    enum WordWrap {
    +	NoWrap,
    +	WidgetWidth,
    +	FixedPixelWidth,
    +	FixedColumnWidth
    +    };
    +
    +    enum WrapPolicy {
    +	AtWordBoundary,
    +	AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated
    +	Anywhere,
    +	AtWordOrDocumentBoundary
    +    };
    +
    +    enum AutoFormatting {
    +	AutoNone = 0,
    +	AutoBulletList = 0x00000001,
    +	AutoAll = 0xffffffff
    +    };
    +
    +    enum KeyboardAction {
    +	ActionBackspace,
    +	ActionDelete,
    +	ActionReturn,
    +	ActionKill,
    +	ActionWordBackspace,
    +	ActionWordDelete
    +    };
    +
    +    enum CursorAction {
    +	MoveBackward,
    +	MoveForward,
    +	MoveWordBackward,
    +	MoveWordForward,
    +	MoveUp,
    +	MoveDown,
    +	MoveLineStart,
    +	MoveLineEnd,
    +	MoveHome,
    +	MoveEnd,
    +	MovePgUp,
    +	MovePgDown
    +    };
    +
    +    enum VerticalAlignment {
    +	AlignNormal,
    +	AlignSuperScript,
    +	AlignSubScript
    +    };
    +
    +    enum TextInsertionFlags {
    +	RedoIndentation = 0x0001,
    +	CheckNewLines = 0x0002,
    +	RemoveSelected = 0x0004
    +    };
    +
    +    TQTextEdit( const TQString& text, const TQString& context = TQString::null,
    +	       TQWidget* parent=0, const char* name=0);
    +    TQTextEdit( TQWidget* parent=0, const char* name=0 );
    +    virtual ~TQTextEdit();
    +    void setPalette( const TQPalette & );
    +
    +    TQString text() const;
    +    TQString text( int para ) const;
    +    TextFormat textFormat() const;
    +    TQString context() const;
    +    TQString documentTitle() const;
    +
    +    void getSelection( int *paraFrom, int *indexFrom,
    +		    int *paraTo, int *indexTo, int selNum = 0 ) const;
    +    virtual bool find( const TQString &expr, bool cs, bool wo, bool forward = TRUE,
    +		       int *para = 0, int *index = 0 );
    +
    +    int paragraphs() const;
    +    int lines() const;
    +    int linesOfParagraph( int para ) const;
    +    int lineOfChar( int para, int chr );
    +    int length() const;
    +    TQRect paragraphRect( int para ) const;
    +    int paragraphAt( const TQPoint &pos ) const;
    +    int charAt( const TQPoint &pos, int *para ) const;
    +    int paragraphLength( int para ) const;
    +
    +    TQStyleSheet* styleSheet() const;
    +#ifndef TQT_NO_MIME
    +    TQMimeSourceFactory* mimeSourceFactory() const;
    +#endif
    +    TQBrush paper() const;
    +    bool linkUnderline() const;
    +
    +    int heightForWidth( int w ) const;
    +
    +    bool hasSelectedText() const;
    +    TQString selectedText() const;
    +    bool isUndoAvailable() const;
    +    bool isRedoAvailable() const;
    +
    +    WordWrap wordWrap() const;
    +    int wrapColumnOrWidth() const;
    +    WrapPolicy wrapPolicy() const;
    +
    +    int tabStopWidth() const;
    +
    +    TQString anchorAt( const TQPoint& pos );
    +    TQString anchorAt( const TQPoint& pos, AnchorAttribute a );
    +
    +    TQSize sizeHint() const;
    +
    +    bool isReadOnly() const { return readonly; }
    +
    +    void getCursorPosition( int *parag, int *index ) const;
    +
    +    bool isModified() const;
    +    bool italic() const;
    +    bool bold() const;
    +    bool underline() const;
    +    TQString family() const;
    +    int pointSize() const;
    +    TQColor color() const;
    +    TQFont font() const;
    +    TQFont currentFont() const;
    +    int alignment() const;
    +    int undoDepth() const;
    +
    +    // do not use, will go away
    +    virtual bool getFormat( int para, int index, TQFont *font, TQColor *color, VerticalAlignment *verticalAlignment );
    +    // do not use, will go away
    +    virtual bool getParagraphFormat( int para, TQFont *font, TQColor *color,
    +				     VerticalAlignment *verticalAlignment, int *alignment,
    +				     TQStyleSheetItem::DisplayMode *displayMode,
    +				     TQStyleSheetItem::ListStyle *listStyle,
    +				     int *listDepth );
    +
    +
    +    bool isOverwriteMode() const { return overWrite; }
    +    TQColor paragraphBackgroundColor( int para ) const;
    +
    +    bool isUndoRedoEnabled() const;
    +    bool eventFilter( TQObject *o, TQEvent *e );
    +    bool tabChangesFocus() const;
    +
    +    void setAutoFormatting( uint features );
    +    uint autoFormatting() const;
    +    TQSyntaxHighlighter *syntaxHighlighter() const;
    +
    +public slots:
    +    void setEnabled( bool );
    +#ifndef TQT_NO_MIME
    +    virtual void setMimeSourceFactory( TQMimeSourceFactory* factory );
    +#endif
    +    virtual void setStyleSheet( TQStyleSheet* styleSheet );
    +    virtual void scrollToAnchor( const TQString& name );
    +    virtual void setPaper( const TQBrush& pap );
    +    virtual void setLinkUnderline( bool );
    +
    +    virtual void setWordWrap( WordWrap mode );
    +    virtual void setWrapColumnOrWidth( int );
    +    virtual void setWrapPolicy( WrapPolicy policy );
    +
    +    virtual void copy();
    +    virtual void append( const TQString& text );
    +
    +    void setText( const TQString &txt ) { setText( txt, TQString::null ); }
    +    virtual void setText( const TQString &txt, const TQString &context );
    +    virtual void setTextFormat( TextFormat f );
    +
    +    virtual void selectAll( bool select = TRUE );
    +    virtual void setTabStopWidth( int ts );
    +    virtual void zoomIn( int range );
    +    virtual void zoomIn() { zoomIn( 1 ); }
    +    virtual void zoomOut( int range );
    +    virtual void zoomOut() { zoomOut( 1 ); }
    +    virtual void zoomTo( int size );
    +
    +    virtual void sync();
    +    virtual void setReadOnly( bool b );
    +
    +    virtual void undo();
    +    virtual void redo();
    +    virtual void cut();
    +    virtual void paste();
    +#ifndef TQT_NO_CLIPBOARD
    +    virtual void pasteSubType( const TQCString &subtype );
    +#endif
    +    virtual void clear();
    +    virtual void del();
    +    virtual void indent();
    +    virtual void setItalic( bool b );
    +    virtual void setBold( bool b );
    +    virtual void setUnderline( bool b );
    +    virtual void setFamily( const TQString &f );
    +    virtual void setPointSize( int s );
    +    virtual void setColor( const TQColor &c );
    +    virtual void setFont( const TQFont &f );
    +    virtual void setVerticalAlignment( VerticalAlignment a );
    +    virtual void setAlignment( int a );
    +
    +    // do not use, will go away
    +    virtual void setParagType( TQStyleSheetItem::DisplayMode dm, TQStyleSheetItem::ListStyle listStyle );
    +
    +    virtual void setCursorPosition( int parag, int index );
    +    virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 );
    +    virtual void setSelectionAttributes( int selNum, const TQColor &back, bool invertText );
    +    virtual void setModified( bool m );
    +    virtual void resetFormat();
    +    virtual void setUndoDepth( int d );
    +    virtual void setFormat( TQTextFormat *f, int flags );
    +    virtual void ensureCursorVisible();
    +    virtual void placeCursor( const TQPoint &pos, TQTextCursor *c = 0 );
    +    virtual void moveCursor( CursorAction action, bool select );
    +    virtual void doKeyboardAction( KeyboardAction action );
    +    virtual void removeSelectedText( int selNum = 0 );
    +    virtual void removeSelection( int selNum = 0 );
    +    virtual void setCurrentFont( const TQFont &f );
    +    virtual void setOverwriteMode( bool b ) { overWrite = b; }
    +
    +    virtual void scrollToBottom();
    +
    +    void insert( const TQString &text, uint insertionFlags = CheckNewLines | RemoveSelected ); // ## virtual in 4.0
    +
    +    // obsolete
    +    virtual void insert( const TQString &text, bool, bool = TRUE, bool = TRUE );
    +
    +    virtual void insertAt( const TQString &text, int para, int index );
    +    virtual void removeParagraph( int para );
    +    virtual void insertParagraph( const TQString &text, int para );
    +
    +    virtual void setParagraphBackgroundColor( int para, const TQColor &bg );
    +    virtual void clearParagraphBackground( int para );
    +
    +    virtual void setUndoRedoEnabled( bool b );
    +    void setTabChangesFocus( bool b ); // ### make virtual in 4.0
    +
    +#ifdef QT_TEXTEDIT_OPTIMIZATION
    +    void polish();
    +    void setMaxLogLines( int numLines );
    +    int maxLogLines();
    +#endif
    +
    +signals:
    +    void textChanged();
    +    void selectionChanged();
    +    void copyAvailable( bool );
    +    void undoAvailable( bool yes );
    +    void redoAvailable( bool yes );
    +    void currentFontChanged( const TQFont &f );
    +    void currentColorChanged( const TQColor &c );
    +    void currentAlignmentChanged( int a );
    +    void currentVerticalAlignmentChanged( VerticalAlignment a );
    +    void cursorPositionChanged( TQTextCursor *c );
    +    void cursorPositionChanged( int para, int pos );
    +    void returnPressed();
    +    void modificationChanged( bool m );
    +    void clicked( int parag, int index );
    +    void doubleClicked( int parag, int index );
    +
    +protected:
    +    void repaintChanged();
    +    void updateStyles();
    +    void drawContents( TQPainter *p, int cx, int cy, int cw, int ch );
    +    bool event( TQEvent *e );
    +    void keyPressEvent( TQKeyEvent *e );
    +    void resizeEvent( TQResizeEvent *e );
    +    void viewportResizeEvent( TQResizeEvent* );
    +    void contentsMousePressEvent( TQMouseEvent *e );
    +    void contentsMouseMoveEvent( TQMouseEvent *e );
    +    void contentsMouseReleaseEvent( TQMouseEvent *e );
    +    void contentsMouseDoubleClickEvent( TQMouseEvent *e );
    +#ifndef TQT_NO_WHEELEVENT
    +    void contentsWheelEvent( TQWheelEvent *e );
    +#endif
    +    void imStartEvent( TQIMEvent * );
    +    void imComposeEvent( TQIMEvent * );
    +    void imEndEvent( TQIMEvent * );
    +#ifndef TQT_NO_DRAGANDDROP
    +    void contentsDragEnterEvent( TQDragEnterEvent *e );
    +    void contentsDragMoveEvent( TQDragMoveEvent *e );
    +    void contentsDragLeaveEvent( TQDragLeaveEvent *e );
    +    void contentsDropEvent( TQDropEvent *e );
    +#endif
    +    void contentsContextMenuEvent( TQContextMenuEvent *e );
    +    bool focusNextPrevChild( bool next );
    +    TQTextDocument *document() const;
    +    TQTextCursor *textCursor() const;
    +    void setDocument( TQTextDocument *doc );
    +    virtual TQPopupMenu *createPopupMenu( const TQPoint& pos );
    +    virtual TQPopupMenu *createPopupMenu();
    +    void drawCursor( bool visible );
    +
    +    void windowActivationChange( bool );
    +
    +protected slots:
    +    virtual void doChangeInterval();
    +    void sliderReleased(); // ### make virtual in 4.0
    +
    +private slots:
    +    void formatMore();
    +    void doResize();
    +    void autoScrollTimerDone();
    +    void blinkCursor();
    +    void setModified();
    +    void startDrag();
    +    void documentWidthChanged( int w );
    +    void clipboardChanged();
    +
    +private:
    +    struct TQ_EXPORT UndoRedoInfo {
    +	enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style, IME };
    +
    +	UndoRedoInfo( TQTextDocument *dc );
    +	~UndoRedoInfo();
    +	void clear();
    +	bool valid() const;
    +
    +	TQUndoRedoInfoPrivate *d;
    +	int id;
    +	int index;
    +	int eid;
    +	int eindex;
    +	TQTextFormat *format;
    +	int flags;
    +	Type type;
    +	TQTextDocument *doc;
    +	TQByteArray styleInformation;
    +    };
    +
    +private:
    +    void updateCursor( const TQPoint & pos );
    +    void handleMouseMove( const TQPoint& pos );
    +    void drawContents( TQPainter * );
    +    virtual bool linksEnabled() const { return FALSE; }
    +    void init();
    +    void checkUndoRedoInfo( UndoRedoInfo::Type t );
    +    void updateCurrentFormat();
    +    bool handleReadOnlyKeyEvent( TQKeyEvent *e );
    +    void makeParagVisible( TQTextParagraph *p );
    +    void normalCopy();
    +    void copyToClipboard();
    +#ifndef TQT_NO_MIME
    +    TQCString pickSpecial(TQMimeSource* ms, bool always_ask, const TQPoint&);
    +    TQTextDrag *dragObject( TQWidget *parent = 0 ) const;
    +#endif
    +#ifndef TQT_NO_MIMECLIPBOARD
    +    void pasteSpecial(const TQPoint&);
    +#endif
    +    void setFontInternal( const TQFont &f );
    +
    +    virtual void emitHighlighted( const TQString & ) {}
    +    virtual void emitLinkClicked( const TQString & ) {}
    +
    +    void readFormats( TQTextCursor &c1, TQTextCursor &c2, TQTextString &text, bool fillStyles = FALSE );
    +    void clearUndoRedo();
    +    void paintDocument( bool drawAll, TQPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 );
    +    void moveCursor( CursorAction action );
    +    void ensureFormatted( TQTextParagraph *p );
    +    void placeCursor( const TQPoint &pos, TQTextCursor *c, bool link );
    +    void updateMicroFocusHint();
    +
    +#ifdef QT_TEXTEDIT_OPTIMIZATION
    +    bool checkOptimMode();
    +    TQString optimText() const;
    +    void optimSetText( const TQString &str );
    +    void optimAppend( const TQString &str );
    +    void optimInsert( const TQString &str, int line, int index );
    +    void optimDrawContents( TQPainter * p, int cx, int cy, int cw, int ch );
    +    void optimMousePressEvent( TQMouseEvent * e );
    +    void optimMouseReleaseEvent( TQMouseEvent * e );
    +    void optimMouseMoveEvent( TQMouseEvent * e );
    +    int  optimCharIndex( const TQString &str, int mx ) const;
    +    void optimSelectAll();
    +    void optimRemoveSelection();
    +    void optimSetSelection( int startLine, int startIdx, int endLine,
    +			    int endIdx );
    +    bool optimHasSelection() const;
    +    TQString optimSelectedText() const;
    +    bool optimFind( const TQString & str, bool, bool, bool, int *, int * );
    +    void optimParseTags( TQString * str, int lineNo = -1, int indexOffset = 0 );
    +    TQTextEditOptimPrivate::Tag * optimPreviousLeftTag( int line );
    +    void optimSetTextFormat( TQTextDocument *, TQTextCursor *, TQTextFormat * f,
    +			     int, int, TQTextEditOptimPrivate::Tag * t );
    +    TQTextEditOptimPrivate::Tag * optimAppendTag( int index, const TQString & tag );
    +    TQTextEditOptimPrivate::Tag * optimInsertTag( int line, int index, const TQString & tag );
    +    void optimCheckLimit( const TQString& str );
    +    bool optimHasBoldMetrics( int line );
    +
    +private slots:
    +    void optimDoAutoScroll();
    +#endif // QT_TEXTEDIT_OPTIMIZATION
    +
    +private:
    +#ifndef TQT_NO_CLIPBOARD
    +    void pasteSubType( const TQCString &subtype, TQMimeSource *m );
    +#endif
    +
    +private:
    +    TQTextDocument *doc;
    +    TQTextCursor *cursor;
    +    TQTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer;
    +    TQTextParagraph *lastFormatted;
    +    int interval;
    +    UndoRedoInfo undoRedoInfo;
    +    TQTextFormat *currentFormat;
    +    int currentAlignment;
    +    TQPoint oldMousePos, mousePos;
    +    TQPoint dragStartPos;
    +    TQString onLink;
    +    WordWrap wrapMode;
    +    WrapPolicy wPolicy;
    +    int wrapWidth;
    +    TQString pressedLink;
    +    TQTextEditPrivate *d;
    +    bool inDoubleClick : 1;
    +    bool mousePressed : 1;
    +    bool cursorVisible : 1;
    +    bool blinkCursorVisible : 1;
    +    bool readOnly : 1;
    +    bool modified : 1;
    +    bool mightStartDrag : 1;
    +    bool inDnD : 1;
    +    bool readonly : 1;
    +    bool undoEnabled : 1;
    +    bool overWrite : 1;
    +
    +private:	// Disabled copy constructor and operator=
    +#if defined(TQ_DISABLE_COPY)
    +    TQTextEdit( const TQTextEdit & );
    +    TQTextEdit &operator=( const TQTextEdit & );
    +#endif
    +};
    +
    +inline TQTextDocument *TQTextEdit::document() const
    +{
    +    return doc;
    +}
    +
    +inline TQTextCursor *TQTextEdit::textCursor() const
    +{
    +    return cursor;
    +}
    +
    +inline void TQTextEdit::setCurrentFont( const TQFont &f )
    +{
    +    TQTextEdit::setFontInternal( f );
    +}
    +
    +#endif //TQT_NO_TEXTEDIT
    +#endif //TQTEXTVIEW_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextedit-members.html b/doc/html/tqtextedit-members.html new file mode 100644 index 00000000..a307f02d --- /dev/null +++ b/doc/html/tqtextedit-members.html @@ -0,0 +1,544 @@ + + + + + +TQTextEdit Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextEdit

    + +

    This is the complete list of member functions for +TQTextEdit, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextedit.html b/doc/html/tqtextedit.html new file mode 100644 index 00000000..fc28e21b --- /dev/null +++ b/doc/html/tqtextedit.html @@ -0,0 +1,1626 @@ + + + + + +TQTextEdit Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextEdit Class Reference

    + +

    The TQTextEdit widget provides a powerful single-page rich text editor. +More... +

    #include <tqtextedit.h> +

    Inherits TQScrollView. +

    Inherited by TQMultiLineEdit, TQTextBrowser, and TQTextView. +

    List of all member functions. +

    Public Members

    + +

    Public Slots

    + +

    Signals

    + +

    Properties

    +
      +
    • AutoFormatting autoFormatting - the enabled set of auto formatting features
    • +
    • TQString documentTitle - the title of the document parsed from the text  (read only)
    • +
    • bool hasSelectedText - whether some text is selected in selection 0  (read only)
    • +
    • int length - the number of characters in the text  (read only)
    • +
    • bool linkUnderline - whether hypertext links will be underlined
    • +
    • bool modified - whether the document has been modified by the user
    • +
    • bool overwriteMode - the text edit's overwrite mode
    • +
    • TQBrush paper - the background (paper) brush
    • +
    • bool readOnly - whether the text edit is read-only
    • +
    • TQString selectedText - the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0)  (read only)
    • +
    • bool tabChangesFocus - whether TAB changes focus or is accepted as input
    • +
    • int tabStopWidth - the tab stop width in pixels
    • +
    • TQString text - the text edit's text
    • +
    • TextFormat textFormat - the text format: rich text, plain text, log text or auto text
    • +
    • int undoDepth - the depth of the undo history
    • +
    • bool undoRedoEnabled - whether undo/redo is enabled
    • +
    • WordWrap wordWrap - the word wrap mode
    • +
    • int wrapColumnOrWidth - the position (in pixels or columns depending on the wrap mode) where text will be wrapped
    • +
    • WrapPolicy wrapPolicy - the word wrap policy, at whitespace or anywhere
    • +
    +

    Protected Members

    + +

    Detailed Description

    + + +The TQTextEdit widget provides a powerful single-page rich text editor. +

    + + +

    +

    + + +

    Introduction and Concepts +

    +

    TQTextEdit is an advanced WYSIWYG viewer/editor supporting rich +text formatting using HTML-style tags. It is optimized to handle +large documents and to respond quickly to user input. +

    TQTextEdit has four modes of operation: +

    +
    Mode Command Notes +
    Plain Text Editor setTextFormat(PlainText) +Set text with setText(); text() returns plain text. Text +attributes (e.g. colors) can be set, but plain text is always +returned. +
    Rich Text Editor setTextFormat(RichText) +Set text with setText(); text() returns rich text. Rich +text editing is fairly limited. You can't set margins or +insert images for example (although you can read and +correctly display files that have margins set and that +include images). This mode is mostly useful for editing small +amounts of rich text. 1. +
    Text Viewer setReadOnly(TRUE) +Set text with setText() or append() (which has no undo +history so is faster and uses less memory); text() returns +plain or rich text depending on the textFormat(). This mode +can correctly display a large subset of HTML tags. +
    Log Viewer setTextFormat(LogText) +Append text using append(). The widget is set to be read +only and rich text support is disabled although a few HTML +tags (for color, bold, italic and underline) may be used. +(See LogText mode for details.) +
    +

    1.A more complete API that supports setting +margins, images, etc., is planned for a later TQt release. +

    TQTextEdit can be used as a syntax highlighting editor when used in +conjunction with TQSyntaxHighlighter. +

    We recommend that you always call setTextFormat() to set the mode +you want to use. If you use AutoText then setText() and +append() will try to determine whether the text they are given is +plain text or rich text. If you use RichText then setText() and +append() will assume that the text they are given is rich text. +insert() simply inserts the text it is given. +

    TQTextEdit works on paragraphs and characters. A paragraph is a +formatted string which is word-wrapped to fit into the width of +the widget. By default when reading plain text, one newline +signify a paragraph. A document consists of zero or more +paragraphs, indexed from 0. Characters are indexed on a +per-paragraph basis, also indexed from 0. The words in the +paragraph are aligned in accordance with the paragraph's +alignment(). Paragraphs are separated by hard line breaks. Each +character within a paragraph has its own attributes, for example, +font and color. +

    The text edit documentation uses the following concepts: +

      +
    • current format -- +this is the format at the current cursor position, and it +is the format of the selected text if any. +
    • current paragraph -- the paragraph which contains the +cursor. +
    +

    TQTextEdit can display images (using TQMimeSourceFactory), lists and +tables. If the text is too large to view within the text edit's +viewport, scrollbars will appear. The text edit can load both +plain text and HTML files (a subset of HTML 3.2 and 4). The +rendering style and the set of valid tags are defined by a +styleSheet(). Custom tags can be created and placed in a custom +style sheet. Change the style sheet with setStyleSheet(); see +TQStyleSheet for details. The images identified by image tags are +displayed if they can be interpreted using the text edit's +TQMimeSourceFactory; see setMimeSourceFactory(). +

    If you want a text browser with more navigation use TQTextBrowser. +If you just need to display a small piece of rich text use TQLabel +or TQSimpleRichText. +

    If you create a new TQTextEdit, and want to allow the user to edit +rich text, call setTextFormat(TQt::RichText) to ensure that the +text is treated as rich text. (Rich text uses HTML tags to set +text formatting attributes. See TQStyleSheet for information on the +HTML tags that are supported.). If you don't call setTextFormat() +explicitly the text edit will guess from the text itself whether +it is rich text or plain text. This means that if the text looks +like HTML or XML it will probably be interpreted as rich text, so +you should call setTextFormat(TQt::PlainText) to preserve such +text. +

    Note that we do not intend to add a full-featured web browser +widget to TQt (because that would easily double TQt's size and only +a few applications would benefit from it). The rich +text support in TQt is designed to provide a fast, portable and +efficient way to add reasonable online help facilities to +applications, and to provide a basis for rich text editors. +

    Using TQTextEdit as a Display Widget +

    +

    TQTextEdit can display a large HTML subset, including tables and +images. +

    The text is set or replaced using setText() which deletes any +existing text and replaces it with the text passed in the +setText() call. If you call setText() with legacy HTML (with +setTextFormat(RichText) in force), and then call text(), the text +that is returned may have different markup, but will render the +same. Text can be inserted with insert(), paste(), pasteSubType() +and append(). Text that is appended does not go into the undo +history; this makes append() faster and consumes less memory. Text +can also be cut(). The entire text is deleted with clear() and the +selected text is deleted with removeSelectedText(). Selected +(marked) text can also be deleted with del() (which will delete +the character to the right of the cursor if no text is selected). +

    Loading and saving text is achieved using setText() and text(), +for example: +

    +    TQFile file( fileName ); // Read the text from a file
    +    if ( file.open( IO_ReadOnly ) ) {
    +        TQTextStream stream( &file );
    +        textEdit->setText( stream.read() );
    +    }
    +
    +    TQFile file( fileName ); // Write the text to a file
    +    if ( file.open( IO_WriteOnly ) ) {
    +        TQTextStream stream( &file );
    +        stream << textEdit->text();
    +        textEdit->setModified( FALSE );
    +    }
    +    
    + +

    By default the text edit wraps words at whitespace to fit within +the text edit widget. The setWordWrap() function is used to +specify the kind of word wrap you want, or NoWrap if you don't +want any wrapping. Call setWordWrap() to set a fixed pixel width +FixedPixelWidth, or character column (e.g. 80 column) FixedColumnWidth with the pixels or columns specified with +setWrapColumnOrWidth(). If you use word wrap to the widget's width +WidgetWidth, you can specify whether to break on whitespace or +anywhere with setWrapPolicy(). +

    The background color is set differently than other widgets, using +setPaper(). You specify a brush style which could be a plain color +or a complex pixmap. +

    Hypertext links are automatically underlined; this can be changed +with setLinkUnderline(). The tab stop width is set with +setTabStopWidth(). +

    The zoomIn() and zoomOut() functions can be used to resize the +text by increasing (decreasing for zoomOut()) the point size used. +Images are not affected by the zoom functions. +

    The lines() function returns the number of lines in the text and +paragraphs() returns the number of paragraphs. The number of lines +within a particular paragraph is returned by linesOfParagraph(). +The length of the entire text in characters is returned by +length(). +

    You can scroll to an anchor in the text, e.g. +<a name="anchor"> with scrollToAnchor(). The find() function +can be used to find and select a given string within the text. +

    A read-only TQTextEdit provides the same functionality as the +(obsolete) TQTextView. (TQTextView is still supplied for +compatibility with old code.) +

    Read-only key bindings +

    +

    When TQTextEdit is used read-only the key-bindings are limited to +navigation, and text may only be selected with the mouse: +

    +
    Keypresses Action +
    UpArrow Move one line up +
    DownArrow Move one line down +
    LeftArrow Move one character left +
    RightArrow Move one character right +
    PageUp Move one (viewport) page up +
    PageDown Move one (viewport) page down +
    Home Move to the beginning of the text +
    End Move to the end of the text +
    Shift+Wheel +Scroll the page horizontally (the Wheel is the mouse wheel) +
    Ctrl+Wheel Zoom the text +
    +

    The text edit may be able to provide some meta-information. For +example, the documentTitle() function will return the text from +within HTML <title> tags. +

    The text displayed in a text edit has a context. The context is +a path which the text edit's TQMimeSourceFactory uses to resolve +the locations of files and images. It is passed to the +mimeSourceFactory() when quering data. (See TQTextEdit() and +context().) +

    +

    Using TQTextEdit in LogText Mode +

    +

    Setting the text format to LogText puts the widget in a special +mode which is optimized for very large texts. Editing, word wrap, +and rich text support are disabled in this mode (the widget is +explicitly made read-only). This allows the text to be stored in a +different, more memory efficient manner. However, a certain degree +of text formatting is supported through the use of formatting tags. +A tag is delimited by < and >. The characters <, > +and & are escaped by using &lt;, &gt; and &amp;. +A tag pair consists of a left and a right tag (or open/close tags). +Left-tags mark the starting point for formatting, while right-tags +mark the ending point. A right-tag always start with a / before +the tag keyword. For example <b> and </b> are a tag pair. +Tags can be nested, but they have to be closed in the same order as +they are opened. For example, <b><u></u></b> is valid, while <b><u></b></u> will output an error message. +

    By using tags it is possible to change the color, bold, italic and +underline settings for a piece of text. A color can be specified +by using the HTML font tag <font color=colorname>. The color +name can be one of the color names from the X11 color database, or +a RGB hex value (e.g #00ff00). Example of valid color tags: +<font color=red>, <font color="light blue">, <font color="#223344">. Bold, italic and underline settings can be +specified by the tags <b>, <i> and <u>. Note that a +tag does not necessarily have to be closed. A valid example: +

    +    This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>.
    +    <font color=green><font color=yellow>Yellow,</font> and <u>green</u>.
    +    
    + +

    Stylesheets can also be used in LogText mode. To create and use a +custom tag, you could do the following: +

    +    TQTextEdit * log = new TQTextEdit( this );
    +    log->setTextFormat( TQt::LogText );
    +    TQStyleSheetItem * item = new TQStyleSheetItem( log->styleSheet(), "mytag" );
    +    item->setColor( "red" );
    +    item->setFontWeight( TQFont::Bold );
    +    item->setFontUnderline( TRUE );
    +    log->append( "This is a <mytag>custom tag</mytag>!" );
    +    
    + +Note that only the color, bold, underline and italic attributes of +a TQStyleSheetItem is used in LogText mode. +

    Note that you can use setMaxLogLines() to limit the number of +lines the widget can hold in LogText mode. +

    There are a few things that you need to be aware of when the +widget is in this mode: +

      +
    • Functions that deal with rich text formatting and cursor +movement will not work or return anything valid. +
    • Lines are equivalent to paragraphs. +
    +

    Using TQTextEdit as an Editor +

    +

    All the information about using TQTextEdit as a display widget also +applies here. +

    The current format's attributes are set with setItalic(), +setBold(), setUnderline(), setFamily() (font family), +setPointSize(), setColor() and setCurrentFont(). The current +paragraph's alignment is set with setAlignment(). +

    Use setSelection() to select text. The setSelectionAttributes() +function is used to indicate how selected text should be +displayed. Use hasSelectedText() to find out if any text is +selected. The currently selected text's position is available +using getSelection() and the selected text itself is returned by +selectedText(). The selection can be copied to the clipboard with +copy(), or cut to the clipboard with cut(). It can be deleted with +removeSelectedText(). The entire text can be selected (or +unselected) using selectAll(). TQTextEdit supports multiple +selections. Most of the selection functions operate on the default +selection, selection 0. If the user presses a non-selecting key, +e.g. a cursor key without also holding down Shift, all selections +are cleared. +

    Set and get the position of the cursor with setCursorPosition() +and getCursorPosition() respectively. When the cursor is moved, +the signals currentFontChanged(), currentColorChanged() and +currentAlignmentChanged() are emitted to reflect the font, color +and alignment at the new cursor position. +

    If the text changes, the textChanged() signal is emitted, and if +the user inserts a new line by pressing Return or Enter, +returnPressed() is emitted. The isModified() function will return +TRUE if the text has been modified. +

    TQTextEdit provides command-based undo and redo. To set the depth +of the command history use setUndoDepth() which defaults to 100 +steps. To undo or redo the last operation call undo() or redo(). +The signals undoAvailable() and redoAvailable() indicate whether +the undo and redo operations can be executed. +

    The indent() function is used to reindent a paragraph. It is +useful for code editors, for example in TQt Designer's code editor Ctrl+I invokes the indent() +function. +

    Editing key bindings +

    +

    The list of key-bindings which are implemented for editing: +

    +
    Keypresses Action +
    Backspace Delete the character to the left of the cursor +
    Delete Delete the character to the right of the cursor +
    Ctrl+A Move the cursor to the beginning of the line +
    Ctrl+B Move the cursor one character left +
    Ctrl+C Copy the marked text to the clipboard (also +Ctrl+Insert under Windows) +
    Ctrl+D Delete the character to the right of the cursor +
    Ctrl+E Move the cursor to the end of the line +
    Ctrl+F Move the cursor one character right +
    Ctrl+H Delete the character to the left of the cursor +
    Ctrl+K Delete to end of line +
    Ctrl+N Move the cursor one line down +
    Ctrl+P Move the cursor one line up +
    Ctrl+V Paste the clipboard text into line edit +(also Shift+Insert under Windows) +
    Ctrl+X Cut the marked text, copy to clipboard +(also Shift+Delete under Windows) +
    Ctrl+Z Undo the last operation +
    Ctrl+Y Redo the last operation +
    LeftArrow Move the cursor one character left +
    Ctrl+LeftArrow Move the cursor one word left +
    RightArrow Move the cursor one character right +
    Ctrl+RightArrow Move the cursor one word right +
    UpArrow Move the cursor one line up +
    Ctrl+UpArrow Move the cursor one word up +
    DownArrow Move the cursor one line down +
    Ctrl+Down Arrow Move the cursor one word down +
    PageUp Move the cursor one page up +
    PageDown Move the cursor one page down +
    Home Move the cursor to the beginning of the line +
    Ctrl+Home Move the cursor to the beginning of the text +
    End Move the cursor to the end of the line +
    Ctrl+End Move the cursor to the end of the text +
    Shift+Wheel Scroll the page horizontally +(the Wheel is the mouse wheel) +
    Ctrl+Wheel Zoom the text +
    +

    To select (mark) text hold down the Shift key whilst pressing one +of the movement keystrokes, for example, Shift+Right Arrow +will select the character to the right, and Shift+Ctrl+Right Arrow will select the word to the right, etc. +

    By default the text edit widget operates in insert mode so all +text that the user enters is inserted into the text edit and any +text to the right of the cursor is moved out of the way. The mode +can be changed to overwrite, where new text overwrites any text to +the right of the cursor, using setOverwriteMode(). +

    See also Basic Widgets and Text Related Classes. + +


    Member Type Documentation

    +

    TQTextEdit::AutoFormatting

    + +
      +
    • TQTextEdit::AutoNone - Do not perform any automatic formatting +
    • TQTextEdit::AutoBulletList - Only automatically format bulletted lists +
    • TQTextEdit::AutoAll - Apply all available autoformatting +
    +

    TQTextEdit::CursorAction

    + +

    This enum is used by moveCursor() to specify in which direction +the cursor should be moved: +

      +
    • TQTextEdit::MoveBackward - Moves the cursor one character backward +
    • TQTextEdit::MoveWordBackward - Moves the cursor one word backward +
    • TQTextEdit::MoveForward - Moves the cursor one character forward +
    • TQTextEdit::MoveWordForward - Moves the cursor one word forward +
    • TQTextEdit::MoveUp - Moves the cursor up one line +
    • TQTextEdit::MoveDown - Moves the cursor down one line +
    • TQTextEdit::MoveLineStart - Moves the cursor to the beginning of the line +
    • TQTextEdit::MoveLineEnd - Moves the cursor to the end of the line +
    • TQTextEdit::MoveHome - Moves the cursor to the beginning of the document +
    • TQTextEdit::MoveEnd - Moves the cursor to the end of the document +
    • TQTextEdit::MovePgUp - Moves the cursor one viewport page up +
    • TQTextEdit::MovePgDown - Moves the cursor one viewport page down +
    +

    TQTextEdit::KeyboardAction

    + +

    This enum is used by doKeyboardAction() to specify which action +should be executed: +

      +
    • TQTextEdit::ActionBackspace - Delete the character to the left of the +cursor. +
    • TQTextEdit::ActionDelete - Delete the character to the right of the +cursor. +
    • TQTextEdit::ActionReturn - Split the paragraph at the cursor position. +
    • TQTextEdit::ActionKill - If the cursor is not at the end of the +paragraph, delete the text from the cursor position until the end +of the paragraph. If the cursor is at the end of the paragraph, +delete the hard line break at the end of the paragraph: this will +cause this paragraph to be joined with the following paragraph. +
    • TQTextEdit::ActionWordBackspace - Delete the word to the left of the +cursor position. +
    • TQTextEdit::ActionWordDelete - Delete the word to the right of the +cursor position +

    +

    TQTextEdit::VerticalAlignment

    + +

    This enum is used to set the vertical alignment of the text. +

      +
    • TQTextEdit::AlignNormal - Normal alignment +
    • TQTextEdit::AlignSuperScript - Superscript +
    • TQTextEdit::AlignSubScript - Subscript +
    +

    TQTextEdit::WordWrap

    + +

    This enum defines the TQTextEdit's word wrap modes. +

      +
    • TQTextEdit::NoWrap - Do not wrap the text. +
    • TQTextEdit::WidgetWidth - Wrap the text at the current width of the +widget (this is the default). Wrapping is at whitespace by +default; this can be changed with setWrapPolicy(). +
    • TQTextEdit::FixedPixelWidth - Wrap the text at a fixed number of pixels +from the widget's left side. The number of pixels is set with +wrapColumnOrWidth(). +
    • TQTextEdit::FixedColumnWidth - Wrap the text at a fixed number of +character columns from the widget's left side. The number of +characters is set with wrapColumnOrWidth(). This is useful if you +need formatted text that can also be displayed gracefully on +devices with monospaced fonts, for example a standard VT100 +terminal, where you might set wrapColumnOrWidth() to 80. +

    See also wordWrap and wordWrap. + +

    TQTextEdit::WrapPolicy

    + +

    This enum defines where text can be wrapped in word wrap mode. +

      +
    • TQTextEdit::AtWhiteSpace - Don't use this deprecated value (it is a +synonym for AtWordBoundary which you should use instead). +
    • TQTextEdit::Anywhere - Break anywhere, including within words. +
    • TQTextEdit::AtWordBoundary - Break lines at word boundaries, e.g. spaces or +newlines +
    • TQTextEdit::AtWordOrDocumentBoundary - Break lines at whitespace, e.g. +spaces or newlines if possible. Break it anywhere otherwise. +

    See also wrapPolicy. + +


    Member Function Documentation

    +

    TQTextEdit::TQTextEdit ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 ) +

    +Constructs a TQTextEdit called name, with parent parent. The +text edit will display the text text using context context. +

    The context is a path which the text edit's TQMimeSourceFactory +uses to resolve the locations of files and images. It is passed to +the mimeSourceFactory() when quering data. +

    For example if the text contains an image tag, +<img src="image.png">, and the context is "path/to/look/in", the +TQMimeSourceFactory will try to load the image from +"path/to/look/in/image.png". If the tag was +<img src="/image.png">, the context will not be used (because +TQMimeSourceFactory recognizes that we have used an absolute path) +and will try to load "/image.png". The context is applied in exactly +the same way to hrefs, for example, +<a href="target.html">Target</a>, would resolve to +"path/to/look/in/target.html". + +

    TQTextEdit::TQTextEdit ( TQWidget * parent = 0, const char * name = 0 ) +

    +Constructs an empty TQTextEdit called name, with parent parent. + +

    int TQTextEdit::alignment () const +

    +Returns the alignment of the current paragraph. +

    See also setAlignment(). + +

    TQString TQTextEdit::anchorAt ( const TQPoint & pos, AnchorAttribute attr ) +

    +If there is an anchor at position pos (in contents +coordinates), the text for attribute attr is returned, +otherwise TQString::null is returned. + +

    TQString TQTextEdit::anchorAt ( const TQPoint & pos ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    If there is an anchor at position pos (in contents +coordinates), its href is returned, otherwise TQString::null is +returned. + +

    void TQTextEdit::append ( const TQString & text ) [virtual slot] +

    +Appends a new paragraph with text to the end of the text edit. Note that +the undo/redo history is cleared by this function, and no undo +history is kept for appends which makes them faster than +insert()s. If you want to append text which is added to the +undo/redo history as well, use insertParagraph(). + +

    Examples: network/clientserver/client/client.cpp, network/clientserver/server/server.cpp, network/httpd/httpd.cpp, and process/process.cpp. +

    uint TQTextEdit::autoFormatting () const +

    Returns the enabled set of auto formatting features. +See the "autoFormatting" property for details. +

    bool TQTextEdit::bold () const +

    +Returns TRUE if the current format is bold; otherwise returns FALSE. +

    See also setBold(). + +

    int TQTextEdit::charAt ( const TQPoint & pos, int * para ) const +

    +Returns the index of the character (relative to its paragraph) at +position pos (in contents coordinates). If para is not 0, +*para is set to the character's paragraph. + +

    void TQTextEdit::clear () [virtual slot] +

    +Deletes all the text in the text edit. +

    See also cut(), removeSelectedText(), and text. + +

    void TQTextEdit::clearParagraphBackground ( int para ) [virtual slot] +

    +Clears the background color of the paragraph para, so that the +default color is used again. + +

    void TQTextEdit::clicked ( int para, int pos ) [signal] +

    + +

    This signal is emitted when the mouse is clicked on the paragraph +para at character position pos. +

    See also doubleClicked(). + +

    TQColor TQTextEdit::color () const +

    +Returns the color of the current format. +

    See also setColor() and paper. + +

    TQString TQTextEdit::context () const +

    +Returns the context of the text edit. The context is a path which +the text edit's TQMimeSourceFactory uses to resolve the locations +of files and images. +

    See also text. + +

    Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp. +

    void TQTextEdit::copy () [virtual slot] +

    +Copies any selected text (from selection 0) to the clipboard. +

    See also hasSelectedText and copyAvailable(). + +

    void TQTextEdit::copyAvailable ( bool yes ) [signal] +

    + +

    This signal is emitted when text is selected or de-selected in the +text edit. +

    When text is selected this signal will be emitted with yes set +to TRUE. If no text has been selected or if the selected text is +de-selected this signal is emitted with yes set to FALSE. +

    If yes is TRUE then copy() can be used to copy the selection to +the clipboard. If yes is FALSE then copy() does nothing. +

    See also selectionChanged(). + +

    TQPopupMenu * TQTextEdit::createPopupMenu ( const TQPoint & pos ) [virtual protected] +

    +This function is called to create a right mouse button popup menu +at the document position pos. If you want to create a custom +popup menu, reimplement this function and return the created popup +menu. Ownership of the popup menu is transferred to the caller. +

    Warning: The TQPopupMenu ID values 0-7 are reserved, and they map to the +standard operations. When inserting items into your custom popup menu, be +sure to specify ID values larger than 7. + +

    TQPopupMenu * TQTextEdit::createPopupMenu () [virtual protected] +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

    This function is called to create a right mouse button popup menu. +If you want to create a custom popup menu, reimplement this function +and return the created popup menu. Ownership of the popup menu is +transferred to the caller. +

    This function is only called if createPopupMenu( const TQPoint & ) +returns 0. + +

    void TQTextEdit::currentAlignmentChanged ( int a ) [signal] +

    + +

    This signal is emitted if the alignment of the current paragraph +has changed. +

    The new alignment is a. +

    See also setAlignment(). + +

    void TQTextEdit::currentColorChanged ( const TQColor & c ) [signal] +

    + +

    This signal is emitted if the color of the current format has +changed. +

    The new color is c. +

    See also setColor(). + +

    TQFont TQTextEdit::currentFont () const +

    +Returns the font of the current format. +

    See also setCurrentFont(), setFamily(), and setPointSize(). + +

    void TQTextEdit::currentFontChanged ( const TQFont & f ) [signal] +

    + +

    This signal is emitted if the font of the current format has +changed. +

    The new font is f. +

    See also setCurrentFont(). + +

    void TQTextEdit::currentVerticalAlignmentChanged ( VerticalAlignment a ) [signal] +

    + +

    This signal is emitted if the vertical alignment of the current +format has changed. +

    The new vertical alignment is a. +

    See also setVerticalAlignment(). + +

    void TQTextEdit::cursorPositionChanged ( int para, int pos ) [signal] +

    + +

    This signal is emitted if the position of the cursor has changed. +para contains the paragraph index and pos contains the +character position within the paragraph. +

    See also setCursorPosition(). + +

    void TQTextEdit::cut () [virtual slot] +

    +Copies the selected text (from selection 0) to the clipboard and +deletes it from the text edit. +

    If there is no selected text (in selection 0) nothing happens. +

    See also TQTextEdit::copy(), paste(), and pasteSubType(). + +

    void TQTextEdit::del () [virtual slot] +

    +If there is some selected text (in selection 0) it is deleted. If +there is no selected text (in selection 0) the character to the +right of the text cursor is deleted. +

    See also removeSelectedText() and cut(). + +

    void TQTextEdit::doKeyboardAction ( KeyboardAction action ) [virtual slot] +

    +Executes keyboard action action. This is normally called by a +key event handler. + +

    TQString TQTextEdit::documentTitle () const +

    Returns the title of the document parsed from the text. +See the "documentTitle" property for details. +

    void TQTextEdit::doubleClicked ( int para, int pos ) [signal] +

    +

    This signal is emitted when the mouse is double-clicked on the +paragraph para at character position pos. +

    See also clicked(). + +

    void TQTextEdit::ensureCursorVisible () [virtual slot] +

    +Ensures that the cursor is visible by scrolling the text edit if +necessary. +

    See also setCursorPosition(). + +

    TQString TQTextEdit::family () const +

    +Returns the font family of the current format. +

    See also setFamily(), setCurrentFont(), and setPointSize(). + +

    bool TQTextEdit::find ( const TQString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 ) [virtual] +

    +Finds the next occurrence of the string, expr. Returns TRUE if +expr was found; otherwise returns FALSE. +

    If para and index are both 0 the search begins from the +current cursor position. If para and index are both not 0, +the search begins from the *index character position in the +*para paragraph. +

    If cs is TRUE the search is case sensitive, otherwise it is +case insensitive. If wo is TRUE the search looks for whole word +matches only; otherwise it searches for any matching text. If forward is TRUE (the default) the search works forward from the +starting position to the end of the text, otherwise it works +backwards to the beginning of the text. +

    If expr is found the function returns TRUE. If index and para are not 0, the number of the paragraph in which the first +character of the match was found is put into *para, and the +index position of that character within the paragraph is put into +*index. +

    If expr is not found the function returns FALSE. If index +and para are not 0 and expr is not found, *index +and *para are undefined. +

    Please note that this function will make the next occurrence of +the string (if found) the current selection, and will thus +modify the cursor position. +

    Using the para and index parameters will not work correctly +in case the document contains tables. + +

    bool TQTextEdit::focusNextPrevChild ( bool n ) [virtual protected] +

    +Reimplemented to allow tabbing through links. If n is TRUE the +tab moves the focus to the next child; if n is FALSE the tab +moves the focus to the previous child. Returns TRUE if the focus +was moved; otherwise returns FALSE. + +

    TQFont TQTextEdit::font () const +

    +This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

    Returns TQScrollView::font() +

    Warning: In previous versions this function returned the font of +the current format. This lead to confusion. Please use +currentFont() instead. + +

    Example: qwerty/qwerty.cpp. +

    void TQTextEdit::getCursorPosition ( int * para, int * index ) const +

    +This function sets the *para and *index parameters to the +current cursor position. para and index must not be 0. +

    See also setCursorPosition(). + +

    void TQTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const +

    +If there is a selection, *paraFrom is set to the number of the +paragraph in which the selection begins and *paraTo is set to +the number of the paragraph in which the selection ends. (They +could be the same.) *indexFrom is set to the index at which the +selection begins within *paraFrom, and *indexTo is set to +the index at which the selection ends within *paraTo. +

    If there is no selection, *paraFrom, *indexFrom, *paraTo +and *indexTo are all set to -1. +

    If paraFrom, indexFrom, paraTo or indexTo is 0 this +function does nothing. +

    The selNum is the number of the selection (multiple selections +are supported). It defaults to 0 (the default selection). +

    See also setSelection() and selectedText. + +

    bool TQTextEdit::hasSelectedText () const +

    Returns TRUE if some text is selected in selection 0; otherwise returns FALSE. +See the "hasSelectedText" property for details. +

    int TQTextEdit::heightForWidth ( int w ) const [virtual] +

    +Returns how many pixels high the text edit needs to be to display +all the text if the text edit is w pixels wide. + +

    Reimplemented from TQWidget. +

    void TQTextEdit::insert ( const TQString & text, uint insertionFlags = CheckNewLines | RemoveSelected ) [slot] +

    +Inserts text at the current cursor position. +

    The insertionFlags define how the text is inserted. If RedoIndentation is set, the paragraph is re-indented. If CheckNewLines is set, newline characters in text result in hard +line breaks (i.e. new paragraphs). If checkNewLine is not set, +the behaviour of the editor is undefined if the text contains +newlines. (It is not possible to change TQTextEdit's newline handling +behavior, but you can use TQString::replace() to preprocess text +before inserting it.) If RemoveSelected is set, any selected +text (in selection 0) is removed before the text is inserted. +

    The default flags are CheckNewLines | RemoveSelected. +

    If the widget is in LogText mode this function will do nothing. +

    See also paste() and pasteSubType(). + +

    void TQTextEdit::insert ( const TQString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE ) [virtual slot] +

    +This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

    +

    void TQTextEdit::insertAt ( const TQString & text, int para, int index ) [virtual slot] +

    +Inserts text in the paragraph para at position index. + +

    void TQTextEdit::insertParagraph ( const TQString & text, int para ) [virtual slot] +

    +Inserts text as a new paragraph at position para. If para +is -1, the text is appended. Use append() if the append operation +is performance critical. + +

    bool TQTextEdit::isModified () const +

    Returns TRUE if the document has been modified by the user; otherwise returns FALSE. +See the "modified" property for details. +

    bool TQTextEdit::isOverwriteMode () const +

    Returns the text edit's overwrite mode. +See the "overwriteMode" property for details. +

    bool TQTextEdit::isReadOnly () const +

    Returns TRUE if the text edit is read-only; otherwise returns FALSE. +See the "readOnly" property for details. +

    bool TQTextEdit::isRedoAvailable () const +

    +Returns TRUE if redo is available; otherwise returns FALSE. + +

    bool TQTextEdit::isUndoAvailable () const +

    +Returns TRUE if undo is available; otherwise returns FALSE. + +

    bool TQTextEdit::isUndoRedoEnabled () const +

    Returns TRUE if undo/redo is enabled; otherwise returns FALSE. +See the "undoRedoEnabled" property for details. +

    bool TQTextEdit::italic () const +

    +Returns TRUE if the current format is italic; otherwise returns FALSE. +

    See also setItalic(). + +

    void TQTextEdit::keyPressEvent ( TQKeyEvent * e ) [virtual protected] +

    +Processes the key event, e. By default key events are used to +provide keyboard navigation and text editing. + +

    Reimplemented from TQWidget. +

    Reimplemented in TQTextBrowser. +

    int TQTextEdit::length () const +

    Returns the number of characters in the text. +See the "length" property for details. +

    int TQTextEdit::lineOfChar ( int para, int index ) +

    +Returns the line number of the line in paragraph para in which +the character at position index appears. The index position is +relative to the beginning of the paragraph. If there is no such +paragraph or no such character at the index position (e.g. the +index is out of range) -1 is returned. + +

    int TQTextEdit::lines () const +

    +Returns the number of lines in the text edit; this could be 0. +

    Warning: This function may be slow. Lines change all the time +during word wrapping, so this function has to iterate over all the +paragraphs and get the number of lines from each one individually. + +

    int TQTextEdit::linesOfParagraph ( int para ) const +

    +Returns the number of lines in paragraph para, or -1 if there +is no paragraph with index para. + +

    bool TQTextEdit::linkUnderline () const +

    Returns TRUE if hypertext links will be underlined; otherwise returns FALSE. +See the "linkUnderline" property for details. +

    int TQTextEdit::maxLogLines () [slot] +

    +Returns the maximum number of lines TQTextEdit can hold in LogText mode. By default the number of lines is unlimited, which +is signified by a value of -1. + +

    TQMimeSourceFactory * TQTextEdit::mimeSourceFactory () const +

    +Returns the TQMimeSourceFactory which is being used by this text +edit. +

    See also setMimeSourceFactory(). + +

    Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp. +

    void TQTextEdit::modificationChanged ( bool m ) [signal] +

    + +

    This signal is emitted when the modification status of the +document has changed. If m is TRUE, the document was modified, +otherwise the modification state has been reset to unmodified. +

    See also modified. + +

    void TQTextEdit::moveCursor ( CursorAction action, bool select ) [virtual slot] +

    +Moves the text cursor according to action. This is normally +used by some key event handler. select specifies whether the +text between the current cursor position and the new position +should be selected. + +

    TQBrush TQTextEdit::paper () const +

    Returns the background (paper) brush. +See the "paper" property for details. +

    int TQTextEdit::paragraphAt ( const TQPoint & pos ) const +

    +Returns the paragraph which is at position pos (in contents +coordinates). + +

    TQColor TQTextEdit::paragraphBackgroundColor ( int para ) const +

    +Returns the background color of the paragraph para or an +invalid color if para is out of range or the paragraph has no +background set + +

    int TQTextEdit::paragraphLength ( int para ) const +

    +Returns the length of the paragraph para (i.e. the number of +characters), or -1 if there is no paragraph with index para. +

    This function ignores newlines. + +

    TQRect TQTextEdit::paragraphRect ( int para ) const +

    +Returns the rectangle of the paragraph para in contents +coordinates, or an invalid rectangle if para is out of range. + +

    int TQTextEdit::paragraphs () const +

    +Returns the number of paragraphs in the text; an empty textedit is always +considered to have one paragraph, so 1 is returned in this case. + +

    void TQTextEdit::paste () [virtual slot] +

    +Pastes the text from the clipboard into the text edit at the +current cursor position. Only plain text is pasted. +

    If there is no text in the clipboard nothing happens. +

    See also pasteSubType(), cut(), and TQTextEdit::copy(). + +

    void TQTextEdit::pasteSubType ( const TQCString & subtype ) [virtual slot] +

    +Pastes the text with format subtype from the clipboard into the +text edit at the current cursor position. The subtype can be +"plain" or "html". +

    If there is no text with format subtype in the clipboard +nothing happens. +

    See also paste(), cut(), and TQTextEdit::copy(). + +

    void TQTextEdit::placeCursor ( const TQPoint & pos, TQTextCursor * c = 0 ) [virtual slot] +

    +Places the cursor c at the character which is closest to position +pos (in contents coordinates). If c is 0, the default text +cursor is used. +

    See also setCursorPosition(). + +

    int TQTextEdit::pointSize () const +

    +Returns the point size of the font of the current format. +

    See also setFamily(), setCurrentFont(), and setPointSize(). + +

    void TQTextEdit::redo () [virtual slot] +

    +Redoes the last operation. +

    If there is no operation to redo, i.e. there is no redo step in +the undo/redo history, nothing happens. +

    See also redoAvailable(), undo(), and undoDepth. + +

    void TQTextEdit::redoAvailable ( bool yes ) [signal] +

    + +

    This signal is emitted when the availability of redo changes. If +yes is TRUE, then redo() will work until redoAvailable( FALSE ) +is next emitted. +

    See also redo() and undoDepth. + +

    void TQTextEdit::removeParagraph ( int para ) [virtual slot] +

    +Removes the paragraph para. + +

    void TQTextEdit::removeSelectedText ( int selNum = 0 ) [virtual slot] +

    +Deletes the text of selection selNum (by default, the default +selection, 0). If there is no selected text nothing happens. +

    See also selectedText and removeSelection(). + +

    void TQTextEdit::removeSelection ( int selNum = 0 ) [virtual slot] +

    +Removes the selection selNum (by default 0). This does not +remove the selected text. +

    See also removeSelectedText(). + +

    void TQTextEdit::repaintChanged () [protected] +

    +Repaints any paragraphs that have changed. +

    Although used extensively internally you shouldn't need to call +this yourself. + +

    void TQTextEdit::returnPressed () [signal] +

    + +

    This signal is emitted if the user pressed the Return or the Enter +key. + +

    void TQTextEdit::scrollToAnchor ( const TQString & name ) [virtual slot] +

    +Scrolls the text edit to make the text at the anchor called name visible, if it can be found in the document. If the anchor +isn't found no scrolling will occur. An anchor is defined using +the HTML anchor tag, e.g. <a name="target">. + +

    void TQTextEdit::scrollToBottom () [virtual slot] +

    +Scrolls to the bottom of the document and does formatting if +required. + +

    void TQTextEdit::selectAll ( bool select = TRUE ) [virtual slot] +

    +If select is TRUE (the default), all the text is selected as +selection 0. If select is FALSE any selected text is +unselected, i.e. the default selection (selection 0) is cleared. +

    See also selectedText. + +

    TQString TQTextEdit::selectedText () const +

    Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). +See the "selectedText" property for details. +

    void TQTextEdit::selectionChanged () [signal] +

    + +

    This signal is emitted whenever the selection changes. +

    See also setSelection() and copyAvailable(). + +

    void TQTextEdit::setAlignment ( int a ) [virtual slot] +

    +Sets the alignment of the current paragraph to a. Valid +alignments are TQt::AlignLeft, TQt::AlignRight, +TQt::AlignJustify and TQt::AlignCenter (which centers +horizontally). + +

    Reimplemented in TQMultiLineEdit. +

    void TQTextEdit::setAutoFormatting ( uint features ) +

    Sets the enabled set of auto formatting features to features. +See the "autoFormatting" property for details. +

    void TQTextEdit::setBold ( bool b ) [virtual slot] +

    +If b is TRUE sets the current format to bold; otherwise sets +the current format to non-bold. +

    See also bold(). + +

    void TQTextEdit::setColor ( const TQColor & c ) [virtual slot] +

    +Sets the color of the current format, i.e. of the text, to c. +

    See also color() and paper. + +

    void TQTextEdit::setCurrentFont ( const TQFont & f ) [virtual slot] +

    + +

    Sets the font of the current format to f. +

    If the widget is in LogText mode this function will do +nothing. Use setFont() instead. +

    See also currentFont(), setPointSize(), and setFamily(). + +

    void TQTextEdit::setCursorPosition ( int para, int index ) [virtual slot] +

    +Sets the cursor to position index in paragraph para. +

    See also getCursorPosition(). + +

    void TQTextEdit::setFamily ( const TQString & fontFamily ) [virtual slot] +

    +Sets the font family of the current format to fontFamily. +

    See also family() and setCurrentFont(). + +

    void TQTextEdit::setItalic ( bool b ) [virtual slot] +

    +If b is TRUE sets the current format to italic; otherwise sets +the current format to non-italic. +

    See also italic(). + +

    void TQTextEdit::setLinkUnderline ( bool ) [virtual slot] +

    Sets whether hypertext links will be underlined. +See the "linkUnderline" property for details. +

    void TQTextEdit::setMaxLogLines ( int limit ) [slot] +

    +Sets the maximum number of lines a TQTextEdit can hold in LogText mode to limit. If limit is -1 (the default), this +signifies an unlimited number of lines. +

    Warning: Never use formatting tags that span more than one line +when the maximum log lines is set. When lines are removed from the +top of the buffer it could result in an unbalanced tag pair, i.e. +the left formatting tag is removed before the right one. + +

    void TQTextEdit::setMimeSourceFactory ( TQMimeSourceFactory * factory ) [virtual slot] +

    +Sets the text edit's mimesource factory to factory. See +TQMimeSourceFactory for further details. +

    See also mimeSourceFactory(). + +

    void TQTextEdit::setModified ( bool m ) [virtual slot] +

    Sets whether the document has been modified by the user to m. +See the "modified" property for details. +

    void TQTextEdit::setOverwriteMode ( bool b ) [virtual slot] +

    Sets the text edit's overwrite mode to b. +See the "overwriteMode" property for details. +

    void TQTextEdit::setPaper ( const TQBrush & pap ) [virtual slot] +

    Sets the background (paper) brush to pap. +See the "paper" property for details. +

    void TQTextEdit::setParagraphBackgroundColor ( int para, const TQColor & bg ) [virtual slot] +

    +Sets the background color of the paragraph para to bg. + +

    void TQTextEdit::setPointSize ( int s ) [virtual slot] +

    +Sets the point size of the current format to s. +

    Note that if s is zero or negative, the behaviour of this +function is not defined. +

    See also pointSize(), setCurrentFont(), and setFamily(). + +

    void TQTextEdit::setReadOnly ( bool b ) [virtual slot] +

    Sets whether the text edit is read-only to b. +See the "readOnly" property for details. +

    void TQTextEdit::setSelection ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 ) [virtual slot] +

    +Sets a selection which starts at position indexFrom in +paragraph paraFrom and ends at position indexTo in paragraph +paraTo. +

    Any existing selections which have a different id (selNum) are +left alone, but if an existing selection has the same id as selNum it is removed and replaced by this selection. +

    Uses the selection settings of selection selNum. If selNum +is 0, this is the default selection. +

    The cursor is moved to the end of the selection if selNum is 0, +otherwise the cursor position remains unchanged. +

    See also getSelection() and selectedText. + +

    void TQTextEdit::setSelectionAttributes ( int selNum, const TQColor & back, bool invertText ) [virtual slot] +

    +Sets the background color of selection number selNum to back +and specifies whether the text of this selection should be +inverted with invertText. +

    This only works for selNum > 0. The default selection (selNum == 0) gets its attributes from the text edit's +colorGroup(). + +

    void TQTextEdit::setStyleSheet ( TQStyleSheet * styleSheet ) [virtual slot] +

    +Sets the stylesheet to use with this text edit to styleSheet. +Changes will only take effect for new text added with setText() or +append(). +

    See also styleSheet(). + +

    void TQTextEdit::setTabChangesFocus ( bool b ) [slot] +

    Sets whether TAB changes focus or is accepted as input to b. +See the "tabChangesFocus" property for details. +

    void TQTextEdit::setTabStopWidth ( int ts ) [virtual slot] +

    Sets the tab stop width in pixels to ts. +See the "tabStopWidth" property for details. +

    void TQTextEdit::setText ( const TQString & txt ) [slot] +

    Sets the text edit's text to txt. +See the "text" property for details. +

    void TQTextEdit::setText ( const TQString & text, const TQString & context ) [virtual slot] +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Changes the text of the text edit to the string text and the +context to context. Any previous text is removed. +

    text may be interpreted either as plain text or as rich text, +depending on the textFormat(). The default setting is AutoText, +i.e. the text edit auto-detects the format from text. +

    For rich text the rendering style and available tags are defined +by a styleSheet(); see TQStyleSheet for details. +

    The optional context is a path which the text edit's +TQMimeSourceFactory uses to resolve the locations of files and +images. (See TQTextEdit::TQTextEdit().) It is passed to the text +edit's TQMimeSourceFactory when quering data. +

    Note that the undo/redo history is cleared by this function. +

    See also text and textFormat. + +

    void TQTextEdit::setTextFormat ( TextFormat f ) [virtual slot] +

    Sets the text format: rich text, plain text, log text or auto text to f. +See the "textFormat" property for details. +

    void TQTextEdit::setUnderline ( bool b ) [virtual slot] +

    +If b is TRUE sets the current format to underline; otherwise +sets the current format to non-underline. +

    See also underline(). + +

    void TQTextEdit::setUndoDepth ( int d ) [virtual slot] +

    Sets the depth of the undo history to d. +See the "undoDepth" property for details. +

    void TQTextEdit::setUndoRedoEnabled ( bool b ) [virtual slot] +

    Sets whether undo/redo is enabled to b. +See the "undoRedoEnabled" property for details. +

    void TQTextEdit::setVerticalAlignment ( VerticalAlignment a ) [virtual slot] +

    +Sets the vertical alignment of the current format, i.e. of the +text, to a. +

    See also color() and paper. + +

    void TQTextEdit::setWordWrap ( WordWrap mode ) [virtual slot] +

    Sets the word wrap mode to mode. +See the "wordWrap" property for details. +

    void TQTextEdit::setWrapColumnOrWidth ( int ) [virtual slot] +

    Sets the position (in pixels or columns depending on the wrap mode) where text will be wrapped. +See the "wrapColumnOrWidth" property for details. +

    void TQTextEdit::setWrapPolicy ( WrapPolicy policy ) [virtual slot] +

    Sets the word wrap policy, at whitespace or anywhere to policy. +See the "wrapPolicy" property for details. +

    TQStyleSheet * TQTextEdit::styleSheet () const +

    +Returns the TQStyleSheet which is being used by this text edit. +

    See also setStyleSheet(). + +

    Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, and mdi/application.cpp. +

    void TQTextEdit::sync () [virtual slot] +

    +TQTextEdit is optimized for large amounts text. One of its +optimizations is to format only the visible text, formatting the rest +on demand, e.g. as the user scrolls, so you don't usually need to +call this function. +

    In some situations you may want to force the whole text +to be formatted. For example, if after calling setText(), you wanted +to know the height of the document (using contentsHeight()), you +would call this function first. + +

    TQSyntaxHighlighter * TQTextEdit::syntaxHighlighter () const +

    +Returns the TQSyntaxHighlighter set on this TQTextEdit. 0 is +returned if no syntax highlighter is set. + +

    bool TQTextEdit::tabChangesFocus () const +

    Returns TRUE if TAB changes focus or is accepted as input; otherwise returns FALSE. +See the "tabChangesFocus" property for details. +

    int TQTextEdit::tabStopWidth () const +

    Returns the tab stop width in pixels. +See the "tabStopWidth" property for details. +

    TQString TQTextEdit::text () const +

    Returns the text edit's text. +See the "text" property for details. +

    TQString TQTextEdit::text ( int para ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Returns the text of paragraph para. +

    If textFormat() is RichText the text will contain HTML +formatting tags. + +

    void TQTextEdit::textChanged () [signal] +

    + +

    This signal is emitted whenever the text in the text edit changes. +

    See also text and append(). + +

    Examples: qwerty/qwerty.cpp and rot13/rot13.cpp. +

    TQTextCursor * TQTextEdit::textCursor () const [protected] +

    + +

    Returns the text edit's text cursor. +

    Warning: TQTextCursor is not in the public API, but in special +circumstances you might wish to use it. + +

    TextFormat TQTextEdit::textFormat () const +

    Returns the text format: rich text, plain text, log text or auto text. +See the "textFormat" property for details. +

    bool TQTextEdit::underline () const +

    +Returns TRUE if the current format is underlined; otherwise returns +FALSE. +

    See also setUnderline(). + +

    void TQTextEdit::undo () [virtual slot] +

    +Undoes the last operation. +

    If there is no operation to undo, i.e. there is no undo step in +the undo/redo history, nothing happens. +

    See also undoAvailable(), redo(), and undoDepth. + +

    void TQTextEdit::undoAvailable ( bool yes ) [signal] +

    + +

    This signal is emitted when the availability of undo changes. If +yes is TRUE, then undo() will work until undoAvailable( FALSE ) +is next emitted. +

    See also undo() and undoDepth. + +

    int TQTextEdit::undoDepth () const +

    Returns the depth of the undo history. +See the "undoDepth" property for details. +

    WordWrap TQTextEdit::wordWrap () const +

    Returns the word wrap mode. +See the "wordWrap" property for details. +

    int TQTextEdit::wrapColumnOrWidth () const +

    Returns the position (in pixels or columns depending on the wrap mode) where text will be wrapped. +See the "wrapColumnOrWidth" property for details. +

    WrapPolicy TQTextEdit::wrapPolicy () const +

    Returns the word wrap policy, at whitespace or anywhere. +See the "wrapPolicy" property for details. +

    void TQTextEdit::zoomIn ( int range ) [virtual slot] +

    +Zooms in on the text by making the base font size range +points larger and recalculating all font sizes to be the new size. +This does not change the size of any images. +

    See also zoomOut(). + +

    void TQTextEdit::zoomIn () [virtual slot] +

    + +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Zooms in on the text by making the base font size one point +larger and recalculating all font sizes to be the new size. This +does not change the size of any images. +

    See also zoomOut(). + +

    void TQTextEdit::zoomOut ( int range ) [virtual slot] +

    +Zooms out on the text by making the base font size range points +smaller and recalculating all font sizes to be the new size. This +does not change the size of any images. +

    See also zoomIn(). + +

    void TQTextEdit::zoomOut () [virtual slot] +

    + +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Zooms out on the text by making the base font size one point +smaller and recalculating all font sizes to be the new size. This +does not change the size of any images. +

    See also zoomIn(). + +

    void TQTextEdit::zoomTo ( int size ) [virtual slot] +

    +Zooms the text by making the base font size size points and +recalculating all font sizes to be the new size. This does not +change the size of any images. + +

    Property Documentation

    +

    AutoFormatting autoFormatting

    +

    This property holds the enabled set of auto formatting features. +

    The value can be any combination of the values in the AutoFormatting enum. The default is AutoAll. Choose AutoNone +to disable all automatic formatting. +

    Currently, the only automatic formatting feature provided is AutoBulletList; future versions of TQt may offer more. + +

    Set this property's value with setAutoFormatting() and get this property's value with autoFormatting(). +

    TQString documentTitle

    +

    This property holds the title of the document parsed from the text. +

    For PlainText the title will be an empty string. For RichText the title will be the text between the <title> tags, +if present, otherwise an empty string. + +

    Get this property's value with documentTitle(). +

    bool hasSelectedText

    +

    This property holds whether some text is selected in selection 0. +

    +

    Get this property's value with hasSelectedText(). +

    int length

    +

    This property holds the number of characters in the text. +

    +

    Get this property's value with length(). +

    bool linkUnderline

    +

    This property holds whether hypertext links will be underlined. +

    If TRUE (the default) hypertext links will be displayed +underlined. If FALSE links will not be displayed underlined. + +

    Set this property's value with setLinkUnderline() and get this property's value with linkUnderline(). +

    bool modified

    +

    This property holds whether the document has been modified by the user. +

    +

    Set this property's value with setModified() and get this property's value with isModified(). +

    bool overwriteMode

    +

    This property holds the text edit's overwrite mode. +

    If FALSE (the default) characters entered by the user are inserted +with any characters to the right being moved out of the way. If +TRUE, the editor is in overwrite mode, i.e. characters entered by +the user overwrite any characters to the right of the cursor +position. + +

    Set this property's value with setOverwriteMode() and get this property's value with isOverwriteMode(). +

    TQBrush paper

    +

    This property holds the background (paper) brush. +

    The brush that is currently used to draw the background of the +text edit. The initial setting is an empty brush. + +

    Set this property's value with setPaper() and get this property's value with paper(). +

    bool readOnly

    +

    This property holds whether the text edit is read-only. +

    In a read-only text edit the user can only navigate through the +text and select text; modifying the text is not possible. +

    This property's default is FALSE. + +

    Set this property's value with setReadOnly() and get this property's value with isReadOnly(). +

    TQString selectedText

    +

    This property holds the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). +

    The text is always returned as PlainText if the textFormat() is +PlainText or AutoText, otherwise it is returned as HTML. +

    See also hasSelectedText. + +

    Get this property's value with selectedText(). +

    bool tabChangesFocus

    This property holds whether TAB changes focus or is accepted as input. +

    In some occasions text edits should not allow the user to input +tabulators or change indentation using the TAB key, as this breaks +the focus chain. The default is FALSE. +

    +

    Set this property's value with setTabChangesFocus() and get this property's value with tabChangesFocus(). +

    int tabStopWidth

    +

    This property holds the tab stop width in pixels. +

    +

    Set this property's value with setTabStopWidth() and get this property's value with tabStopWidth(). +

    TQString text

    +

    This property holds the text edit's text. +

    There is no default text. +

    On setting, any previous text is deleted. +

    The text may be interpreted either as plain text or as rich text, +depending on the textFormat(). The default setting is AutoText, +i.e. the text edit auto-detects the format of the text. +

    For richtext, calling text() on an editable TQTextEdit will cause +the text to be regenerated from the textedit. This may mean that +the TQString returned may not be exactly the same as the one that +was set. +

    See also textFormat. + +

    Set this property's value with setText() and get this property's value with text(). +

    TextFormat textFormat

    +

    This property holds the text format: rich text, plain text, log text or auto text. +

    The text format is one of the following: +

      +
    • PlainText - all characters, except newlines, are displayed +verbatim, including spaces. Whenever a newline appears in the text +the text edit inserts a hard line break and begins a new +paragraph. +
    • RichText - rich text rendering. The available styles are +defined in the default stylesheet TQStyleSheet::defaultSheet(). +
    • LogText - optimized mode for very large texts. Supports a very +limited set of formatting tags (color, bold, underline and italic +settings). +
    • AutoText - this is the default. The text edit autodetects which +rendering style is best, PlainText or RichText. This is done +by using the TQStyleSheet::mightBeRichText() function. +
    + +

    Set this property's value with setTextFormat() and get this property's value with textFormat(). +

    int undoDepth

    +

    This property holds the depth of the undo history. +

    The maximum number of steps in the undo/redo history. The default +is 100. +

    See also undo() and redo(). + +

    Set this property's value with setUndoDepth() and get this property's value with undoDepth(). +

    bool undoRedoEnabled

    +

    This property holds whether undo/redo is enabled. +

    When changing this property, the undo/redo history is cleared. +

    The default is TRUE. + +

    Set this property's value with setUndoRedoEnabled() and get this property's value with isUndoRedoEnabled(). +

    WordWrap wordWrap

    +

    This property holds the word wrap mode. +

    The default mode is WidgetWidth which causes words to be +wrapped at the right edge of the text edit. Wrapping occurs at +whitespace, keeping whole words intact. If you want wrapping to +occur within words use setWrapPolicy(). If you set a wrap mode of +FixedPixelWidth or FixedColumnWidth you should also call +setWrapColumnOrWidth() with the width you want. +

    See also WordWrap, wrapColumnOrWidth, and wrapPolicy. + +

    Set this property's value with setWordWrap() and get this property's value with wordWrap(). +

    int wrapColumnOrWidth

    +

    This property holds the position (in pixels or columns depending on the wrap mode) where text will be wrapped. +

    If the wrap mode is FixedPixelWidth, the value is the number of +pixels from the left edge of the text edit at which text should be +wrapped. If the wrap mode is FixedColumnWidth, the value is the +column number (in character columns) from the left edge of the +text edit at which text should be wrapped. +

    See also wordWrap. + +

    Set this property's value with setWrapColumnOrWidth() and get this property's value with wrapColumnOrWidth(). +

    WrapPolicy wrapPolicy

    +

    This property holds the word wrap policy, at whitespace or anywhere. +

    Defines where text can be wrapped when word wrap mode is not NoWrap. The choices are AtWordBoundary (the default), Anywhere and AtWordOrDocumentBoundary +

    See also wordWrap. + +

    Set this property's value with setWrapPolicy() and get this property's value with wrapPolicy(). + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextencoder-members.html b/doc/html/tqtextencoder-members.html new file mode 100644 index 00000000..6354112e --- /dev/null +++ b/doc/html/tqtextencoder-members.html @@ -0,0 +1,48 @@ + + + + + +TQTextEncoder Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextEncoder

    + +

    This is the complete list of member functions for +TQTextEncoder, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextencoder.html b/doc/html/tqtextencoder.html new file mode 100644 index 00000000..eb085a7a --- /dev/null +++ b/doc/html/tqtextencoder.html @@ -0,0 +1,79 @@ + + + + + +TQTextEncoder Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextEncoder Class Reference

    + +

    The TQTextEncoder class provides a state-based encoder. +More... +

    All the functions in this class are reentrant when TQt is built with thread support.

    +

    #include <tqtextcodec.h> +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + +The TQTextEncoder class provides a state-based encoder. + + +

    The encoder converts Unicode into another format, remembering any +state that is required between calls. +

    See also TQTextCodec::makeEncoder() and Internationalization with TQt. + +


    Member Function Documentation

    +

    TQTextEncoder::~TQTextEncoder () [virtual] +

    +Destroys the encoder. + +

    TQCString TQTextEncoder::fromUnicode ( const TQString & uc, int & lenInOut ) [pure virtual] +

    + +

    Converts lenInOut characters (not bytes) from uc, producing +a TQCString. lenInOut will be set to the length of the result (in bytes). +

    The encoder is free to record state to use when subsequent calls +are made to this function (for example, it might change modes with +escape sequences if needed during the encoding of one string, then +assume that mode applies when a subsequent call begins). + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextistream-members.html b/doc/html/tqtextistream-members.html new file mode 100644 index 00000000..76a3eaa7 --- /dev/null +++ b/doc/html/tqtextistream-members.html @@ -0,0 +1,69 @@ + + + + + +TQTextIStream Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextIStream

    + +

    This is the complete list of member functions for +TQTextIStream, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextistream.html b/doc/html/tqtextistream.html new file mode 100644 index 00000000..d74a0247 --- /dev/null +++ b/doc/html/tqtextistream.html @@ -0,0 +1,91 @@ + + + + + +TQTextIStream Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextIStream Class Reference

    + +

    The TQTextIStream class is a convenience class for input streams. +More... +

    All the functions in this class are reentrant when TQt is built with thread support.

    +

    #include <tqtextstream.h> +

    Inherits TQTextStream. +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + + +The TQTextIStream class is a convenience class for input streams. +

    + +

    This class provides a shorthand for creating simple input +TQTextStreams without having to pass a mode argument to the +constructor. +

    This class makes it easy, for example, to write things like this: +

    +    TQString data = "123 456";
    +    int a, b;
    +    TQTextIStream(&data) >> a >> b;
    +    
    + +

    See also TQTextOStream, Input/Output and Networking, and Text Related Classes. + +


    Member Function Documentation

    +

    TQTextIStream::TQTextIStream ( const TQString * s ) +

    + +

    Constructs a stream to read from the string s. + +

    TQTextIStream::TQTextIStream ( TQByteArray ba ) +

    + +

    Constructs a stream to read from the array ba. + +

    TQTextIStream::TQTextIStream ( FILE * f ) +

    + +

    Constructs a stream to read from the file f. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextostream-members.html b/doc/html/tqtextostream-members.html new file mode 100644 index 00000000..806c03f7 --- /dev/null +++ b/doc/html/tqtextostream-members.html @@ -0,0 +1,69 @@ + + + + + +TQTextOStream Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextOStream

    + +

    This is the complete list of member functions for +TQTextOStream, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextostream.html b/doc/html/tqtextostream.html new file mode 100644 index 00000000..ad721f20 --- /dev/null +++ b/doc/html/tqtextostream.html @@ -0,0 +1,90 @@ + + + + + +TQTextOStream Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextOStream Class Reference

    + +

    The TQTextOStream class is a convenience class for output streams. +More... +

    All the functions in this class are reentrant when TQt is built with thread support.

    +

    #include <tqtextstream.h> +

    Inherits TQTextStream. +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + + +The TQTextOStream class is a convenience class for output streams. +

    + +

    This class provides a shorthand for creating simple output +TQTextStreams without having to pass a mode argument to the +constructor. +

    This makes it easy for example, to write things like this: +

    +    TQString result;
    +    TQTextOStream(&result) << "pi = " << 3.14;
    +    
    + +

    See also Input/Output and Networking and Text Related Classes. + +


    Member Function Documentation

    +

    TQTextOStream::TQTextOStream ( TQString * s ) +

    + +

    Constructs a stream to write to string s. + +

    TQTextOStream::TQTextOStream ( TQByteArray ba ) +

    + +

    Constructs a stream to write to the array ba. + +

    TQTextOStream::TQTextOStream ( FILE * f ) +

    + +

    Constructs a stream to write to the file f. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextstream-h.html b/doc/html/tqtextstream-h.html new file mode 100644 index 00000000..0225c593 --- /dev/null +++ b/doc/html/tqtextstream-h.html @@ -0,0 +1,383 @@ + + + + + +tqtextstream.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqtextstream.h

    + +

    This is the verbatim text of the tqtextstream.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqtextstream.h   3.3.8   edited Jan 11 14:38 $
    +**
    +** Definition of TQTextStream class
    +**
    +** Created : 940922
    +**
    +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the tools module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial licenses may use this file in accordance with the TQt
    +** Commercial License Agreement provided with the Software.
    +**
    +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQTEXTSTREAM_H
    +#define TQTEXTSTREAM_H
    +
    +#ifndef QT_H
    +#include "ntqiodevice.h"
    +#include "tqstring.h"
    +#include <stdio.h>
    +#endif // QT_H
    +
    +#ifndef TQT_NO_TEXTSTREAM
    +class TQTextCodec;
    +class TQTextDecoder;
    +
    +class TQTextStreamPrivate;
    +
    +class TQ_EXPORT TQTextStream				// text stream class
    +{
    +public:
    +    enum Encoding { Locale, Latin1, Unicode, UnicodeNetworkOrder,
    +		    UnicodeReverse, RawUnicode, UnicodeUTF8 };
    +
    +    void	setEncoding( Encoding );
    +#ifndef TQT_NO_TEXTCODEC
    +    void	setCodec( TQTextCodec* );
    +    TQTextCodec *codec();
    +#endif
    +
    +    TQTextStream();
    +    TQTextStream( TQIODevice * );
    +    TQTextStream( TQString*, int mode );
    +    TQTextStream( TQString&, int mode );		// obsolete
    +    TQTextStream( TQByteArray, int mode );
    +    TQTextStream( FILE *, int mode );
    +    virtual ~TQTextStream();
    +
    +    TQIODevice	*device() const;
    +    void	 setDevice( TQIODevice * );
    +    void	 unsetDevice();
    +
    +    bool	 atEnd() const;
    +    bool	 eof() const;
    +
    +    TQTextStream &operator>>( TQChar & );
    +    TQTextStream &operator>>( char & );
    +    TQTextStream &operator>>( signed short & );
    +    TQTextStream &operator>>( unsigned short & );
    +    TQTextStream &operator>>( signed int & );
    +    TQTextStream &operator>>( unsigned int & );
    +    TQTextStream &operator>>( signed long & );
    +    TQTextStream &operator>>( unsigned long & );
    +    TQTextStream &operator>>( float & );
    +    TQTextStream &operator>>( double & );
    +    TQTextStream &operator>>( char * );
    +    TQTextStream &operator>>( TQString & );
    +    TQTextStream &operator>>( TQCString & );
    +
    +    TQTextStream &operator<<( TQChar );
    +    TQTextStream &operator<<( char );
    +    TQTextStream &operator<<( signed short );
    +    TQTextStream &operator<<( unsigned short );
    +    TQTextStream &operator<<( signed int );
    +    TQTextStream &operator<<( unsigned int );
    +    TQTextStream &operator<<( signed long );
    +    TQTextStream &operator<<( unsigned long );
    +    TQTextStream &operator<<( float );
    +    TQTextStream &operator<<( double );
    +    TQTextStream &operator<<( const char* );
    +    TQTextStream &operator<<( const TQString & );
    +    TQTextStream &operator<<( const TQCString & );
    +    TQTextStream &operator<<( void * );		// any pointer
    +
    +    TQTextStream &readRawBytes( char *, uint len );
    +    TQTextStream &writeRawBytes( const char* , uint len );
    +
    +    TQString	readLine();
    +    TQString	read();
    +    void	skipWhiteSpace();
    +
    +    enum {
    +	skipws	  = 0x0001,			// skip whitespace on input
    +	left	  = 0x0002,			// left-adjust output
    +	right	  = 0x0004,			// right-adjust output
    +	internal  = 0x0008,			// pad after sign
    +	bin	  = 0x0010,			// binary format integer
    +	oct	  = 0x0020,			// octal format integer
    +	dec	  = 0x0040,			// decimal format integer
    +	hex	  = 0x0080,			// hex format integer
    +	showbase  = 0x0100,			// show base indicator
    +	showpoint = 0x0200,			// force decimal point (float)
    +	uppercase = 0x0400,			// upper-case hex output
    +	showpos	  = 0x0800,			// add '+' to positive integers
    +	scientific= 0x1000,			// scientific float output
    +	fixed	  = 0x2000			// fixed float output
    +    };
    +
    +    static const int basefield;			// bin | oct | dec | hex
    +    static const int adjustfield;		// left | right | internal
    +    static const int floatfield;		// scientific | fixed
    +
    +    int	  flags() const;
    +    int	  flags( int f );
    +    int	  setf( int bits );
    +    int	  setf( int bits, int mask );
    +    int	  unsetf( int bits );
    +
    +    void  reset();
    +
    +    int	  width()	const;
    +    int	  width( int );
    +    int	  fill()	const;
    +    int	  fill( int );
    +    int	  precision()	const;
    +    int	  precision( int );
    +
    +private:
    +    long	input_int();
    +    void	init();
    +    TQTextStream &output_int( int, ulong, bool );
    +    TQIODevice	*dev;
    +
    +    int		fflags;
    +    int		fwidth;
    +    int		fillchar;
    +    int		fprec;
    +    bool	doUnicodeHeader;
    +    bool	owndev;
    +    TQTextCodec 	*mapper;
    +    TQTextStreamPrivate * d;
    +    TQChar	unused1; // ### remove in TQt 4.0
    +    bool	latin1;
    +    bool 	internalOrder;
    +    bool	networkOrder;
    +    void	*unused2; // ### remove in TQt 4.0
    +
    +    TQChar	eat_ws();
    +    uint 	ts_getline( TQChar* );
    +    void	ts_ungetc( TQChar );
    +    TQChar	ts_getc();
    +    uint	ts_getbuf( TQChar*, uint );
    +    void	ts_putc(int);
    +    void	ts_putc(TQChar);
    +    bool	ts_isspace(TQChar);
    +    bool	ts_isdigit(TQChar);
    +    ulong	input_bin();
    +    ulong	input_oct();
    +    ulong	input_dec();
    +    ulong	input_hex();
    +    double	input_double();
    +    TQTextStream &writeBlock( const char* p, uint len );
    +    TQTextStream &writeBlock( const TQChar* p, uint len );
    +
    +private:	// Disabled copy constructor and operator=
    +#if defined(TQ_DISABLE_COPY)
    +    TQTextStream( const TQTextStream & );
    +    TQTextStream &operator=( const TQTextStream & );
    +#endif
    +};
    +
    +typedef TQTextStream TQTS;
    +
    +class TQ_EXPORT TQTextIStream : public TQTextStream {
    +public:
    +    TQTextIStream( const TQString* s ) :
    +	TQTextStream((TQString*)s,IO_ReadOnly) { }
    +    TQTextIStream( TQByteArray ba ) :
    +	TQTextStream(ba,IO_ReadOnly) { }
    +    TQTextIStream( FILE *f ) :
    +	TQTextStream(f,IO_ReadOnly) { }
    +
    +private:	// Disabled copy constructor and operator=
    +#if defined(TQ_DISABLE_COPY)
    +    TQTextIStream( const TQTextIStream & );
    +    TQTextIStream &operator=( const TQTextIStream & );
    +#endif
    +};
    +
    +class TQ_EXPORT TQTextOStream : public TQTextStream {
    +public:
    +    TQTextOStream( TQString* s ) :
    +	TQTextStream(s,IO_WriteOnly) { }
    +    TQTextOStream( TQByteArray ba ) :
    +	TQTextStream(ba,IO_WriteOnly) { }
    +    TQTextOStream( FILE *f ) :
    +	TQTextStream(f,IO_WriteOnly) { }
    +
    +private:	// Disabled copy constructor and operator=
    +#if defined(TQ_DISABLE_COPY)
    +    TQTextOStream( const TQTextOStream & );
    +    TQTextOStream &operator=( const TQTextOStream & );
    +#endif
    +};
    +
    +/*****************************************************************************
    +  TQTextStream inline functions
    + *****************************************************************************/
    +
    +inline TQIODevice *TQTextStream::device() const
    +{ return dev; }
    +
    +inline bool TQTextStream::atEnd() const
    +{ return dev ? dev->atEnd() : FALSE; }
    +
    +inline bool TQTextStream::eof() const
    +{ return atEnd(); }
    +
    +inline int TQTextStream::flags() const
    +{ return fflags; }
    +
    +inline int TQTextStream::flags( int f )
    +{ int oldf = fflags;  fflags = f;  return oldf; }
    +
    +inline int TQTextStream::setf( int bits )
    +{ int oldf = fflags;  fflags |= bits;  return oldf; }
    +
    +inline int TQTextStream::setf( int bits, int mask )
    +{ int oldf = fflags;  fflags = (fflags & ~mask) | (bits & mask); return oldf; }
    +
    +inline int TQTextStream::unsetf( int bits )
    +{ int oldf = fflags;  fflags &= ~bits;	return oldf; }
    +
    +inline int TQTextStream::width() const
    +{ return fwidth; }
    +
    +inline int TQTextStream::width( int w )
    +{ int oldw = fwidth;  fwidth = w;  return oldw;	 }
    +
    +inline int TQTextStream::fill() const
    +{ return fillchar; }
    +
    +inline int TQTextStream::fill( int f )
    +{ int oldc = fillchar;	fillchar = f;  return oldc;  }
    +
    +inline int TQTextStream::precision() const
    +{ return fprec; }
    +
    +inline int TQTextStream::precision( int p )
    +{ int oldp = fprec;  fprec = p;	 return oldp;  }
    +
    +/*!
    +  Returns one character from the stream, or EOF.
    +*/
    +inline TQChar TQTextStream::ts_getc()
    +{ TQChar r; return ( ts_getbuf( &r,1 ) == 1 ? r : TQChar((ushort)0xffff) ); }
    +
    +/*****************************************************************************
    +  TQTextStream manipulators
    + *****************************************************************************/
    +
    +typedef TQTextStream & (*TQTSFUNC)(TQTextStream &);// manipulator function
    +typedef int (TQTextStream::*TQTSMFI)(int);	// manipulator w/int argument
    +
    +class TQ_EXPORT TQTSManip {			// text stream manipulator
    +public:
    +    TQTSManip( TQTSMFI m, int a ) { mf=m; arg=a; }
    +    void exec( TQTextStream &s ) { (s.*mf)(arg); }
    +private:
    +    TQTSMFI mf;					// TQTextStream member function
    +    int	   arg;					// member function argument
    +};
    +
    +TQ_EXPORT inline TQTextStream &operator>>( TQTextStream &s, TQTSFUNC f )
    +{ return (*f)( s ); }
    +
    +TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSFUNC f )
    +{ return (*f)( s ); }
    +
    +TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSManip m )
    +{ m.exec(s); return s; }
    +
    +TQ_EXPORT TQTextStream &bin( TQTextStream &s );	// set bin notation
    +TQ_EXPORT TQTextStream &oct( TQTextStream &s );	// set oct notation
    +TQ_EXPORT TQTextStream &dec( TQTextStream &s );	// set dec notation
    +TQ_EXPORT TQTextStream &hex( TQTextStream &s );	// set hex notation
    +TQ_EXPORT TQTextStream &endl( TQTextStream &s );	// insert EOL ('\n')
    +TQ_EXPORT TQTextStream &flush( TQTextStream &s );	// flush output
    +TQ_EXPORT TQTextStream &ws( TQTextStream &s );	// eat whitespace on input
    +TQ_EXPORT TQTextStream &reset( TQTextStream &s );	// set default flags
    +
    +TQ_EXPORT inline TQTSManip qSetW( int w )
    +{
    +    TQTSMFI func = &TQTextStream::width;
    +    return TQTSManip(func,w);
    +}
    +
    +TQ_EXPORT inline TQTSManip qSetFill( int f )
    +{
    +    TQTSMFI func = &TQTextStream::fill;
    +    return TQTSManip(func,f);
    +}
    +
    +TQ_EXPORT inline TQTSManip qSetPrecision( int p )
    +{
    +    TQTSMFI func = &TQTextStream::precision;
    +    return TQTSManip(func,p);
    +}
    +
    +#endif // TQT_NO_TEXTSTREAM
    +#endif // TQTEXTSTREAM_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextstream-members.html b/doc/html/tqtextstream-members.html new file mode 100644 index 00000000..073922a6 --- /dev/null +++ b/doc/html/tqtextstream-members.html @@ -0,0 +1,70 @@ + + + + + +TQTextStream Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextStream

    + +

    This is the complete list of member functions for +TQTextStream, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextstream.html b/doc/html/tqtextstream.html new file mode 100644 index 00000000..683aa875 --- /dev/null +++ b/doc/html/tqtextstream.html @@ -0,0 +1,667 @@ + + + + + +TQTextStream Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextStream Class Reference

    + +

    The TQTextStream class provides basic functions for reading +and writing text using a TQIODevice. +More... +

    All the functions in this class are reentrant when TQt is built with thread support.

    +

    #include <tqtextstream.h> +

    Inherited by TQTextIStream and TQTextOStream. +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + + +The TQTextStream class provides basic functions for reading +and writing text using a TQIODevice. +

    + + +

    The text stream class has a functional interface that is very +similar to that of the standard C++ iostream class. +

    TQt provides several global functions similar to the ones in iostream: +

    +
    Function Meaning +
    bin sets the TQTextStream to read/write binary numbers +
    oct sets the TQTextStream to read/write octal numbers +
    dec sets the TQTextStream to read/write decimal numbers +
    hex sets the TQTextStream to read/write hexadecimal numbers +
    endl forces a line break +
    flush forces the TQIODevice to flush any buffered data +
    ws eats any available whitespace (on input) +
    reset resets the TQTextStream to its default mode (see reset()) +
    qSetW(int) sets the field width +to the given argument +
    qSetFill(int) sets the fill character to the given argument +
    qSetPrecision(int) sets the precision to the given argument +
    +

    Warning: By default TQTextStream will automatically detect whether +integers in the stream are in decimal, octal, hexadecimal or +binary format when reading from the stream. In particular, a +leading '0' signifies octal, i.e. the sequence "0100" will be +interpreted as 64. +

    The TQTextStream class reads and writes text; it is not appropriate +for dealing with binary data (but TQDataStream is). +

    By default, output of Unicode text (i.e. TQString) is done using +the local 8-bit encoding. This can be changed using the +setEncoding() method. For input, the TQTextStream will auto-detect +standard Unicode "byte order marked" text files; otherwise the +local 8-bit encoding is used. +

    The TQIODevice is set in the constructor, or later using +setDevice(). If the end of the input is reached atEnd() returns +TRUE. Data can be read into variables of the appropriate type +using the operator>>() overloads, or read in its entirety into a +single string using read(), or read a line at a time using +readLine(). Whitespace can be skipped over using skipWhiteSpace(). +You can set flags for the stream using flags() or setf(). The +stream also supports width(), precision() and fill(); use reset() +to reset the defaults. +

    See also TQDataStream, Input/Output and Networking, and Text Related Classes. + +


    Member Type Documentation

    +

    TQTextStream::Encoding

    + +
      +
    • TQTextStream::Locale +
    • TQTextStream::Latin1 +
    • TQTextStream::Unicode +
    • TQTextStream::UnicodeNetworkOrder +
    • TQTextStream::UnicodeReverse +
    • TQTextStream::RawUnicode +
    • TQTextStream::UnicodeUTF8 +

    See setEncoding() for an explanation of the encodings. + +


    Member Function Documentation

    +

    TQTextStream::TQTextStream () +

    +Constructs a data stream that has no IO device. + +

    TQTextStream::TQTextStream ( TQIODevice * iod ) +

    +Constructs a text stream that uses the IO device iod. + +

    TQTextStream::TQTextStream ( TQString * str, int filemode ) +

    +Constructs a text stream that operates on the Unicode TQString, str, through an internal device. The filemode argument is +passed to the device's open() function; see TQIODevice::mode(). +

    If you set an encoding or codec with setEncoding() or setCodec(), +this setting is ignored for text streams that operate on TQString. +

    Example: +

    +    TQString str;
    +    TQTextStream ts( &str, IO_WriteOnly );
    +    ts << "pi = " << 3.14; // str == "pi = 3.14"
    +    
    + +

    Writing data to the text stream will modify the contents of the +string. The string will be expanded when data is written beyond +the end of the string. Note that the string will not be truncated: +

    +    TQString str = "pi = 3.14";
    +    TQTextStream ts( &str, IO_WriteOnly );
    +    ts <<  "2+2 = " << 2+2; // str == "2+2 = 414"
    +    
    + +

    Note that because TQString is Unicode, you should not use +readRawBytes() or writeRawBytes() on such a stream. + +

    TQTextStream::TQTextStream ( TQString & str, int filemode ) +

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

    This constructor is equivalent to the constructor taking a TQString* +parameter. + +

    TQTextStream::TQTextStream ( TQByteArray a, int mode ) +

    +Constructs a text stream that operates on the byte array, a, +through an internal TQBuffer device. The mode argument is passed +to the device's open() function; see TQIODevice::mode(). +

    Example: +

    +    TQByteArray array;
    +    TQTextStream ts( array, IO_WriteOnly );
    +    ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"
    +    
    + +

    Writing data to the text stream will modify the contents of the +array. The array will be expanded when data is written beyond the +end of the string. +

    Same example, using a TQBuffer: +

    +    TQByteArray array;
    +    TQBuffer buf( array );
    +    buf.open( IO_WriteOnly );
    +    TQTextStream ts( &buf );
    +    ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"
    +    buf.close();
    +    
    + + +

    TQTextStream::TQTextStream ( FILE * fh, int mode ) +

    +Constructs a text stream that operates on an existing file handle +fh through an internal TQFile device. The mode argument is +passed to the device's open() function; see TQIODevice::mode(). +

    Note that if you create a TQTextStream cout or another name that +is also used for another variable of a different type, some +linkers may confuse the two variables, which will often cause +crashes. + +

    TQTextStream::~TQTextStream () [virtual] +

    +Destroys the text stream. +

    The destructor does not affect the current IO device. + +

    bool TQTextStream::atEnd () const +

    + +

    Returns TRUE if the IO device has reached the end position (end of +the stream or file) or if there is no IO device set; otherwise +returns FALSE. +

    See also TQIODevice::atEnd(). + +

    Examples: addressbook/centralwidget.cpp and grapher/grapher.cpp. +

    TQTextCodec * TQTextStream::codec () +

    +Returns the codec actually used for this stream. +

    If Unicode is automatically detected in input, a codec with name() "ISO-10646-UCS-2" is returned. +

    See also setCodec(). + +

    TQIODevice * TQTextStream::device () const +

    + +

    Returns the IO device currently set. +

    See also setDevice() and unsetDevice(). + +

    bool TQTextStream::eof () const +

    +

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

    This function has been renamed to atEnd(). +

    See also TQIODevice::atEnd(). + +

    Example: chart/chartform_files.cpp. +

    int TQTextStream::fill () const +

    + +

    Returns the fill character. The default value is ' ' (space). + +

    int TQTextStream::fill ( int f ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Sets the fill character to f. Returns the previous fill character. + +

    int TQTextStream::flags () const +

    + +

    Returns the current stream flags. The default value is 0. +

    +
    Flag Meaning +
    skipws Not currently used; whitespace always skipped +
    left Numeric fields are left-aligned +
    right +Not currently used (by default, numerics are right-aligned) +
    internal Puts any padding spaces between +/- and value +
    bin Output and input only in binary +
    oct Output and input only in octal +
    dec Output and input only in decimal +
    hex Output and input only in hexadecimal +
    showbase +Annotates numeric outputs with 0b, 0, or 0x if in bin, +oct, or hex format +
    showpoint Not currently used +
    uppercase Uses 0B and 0X rather than 0b and 0x +
    showpos Shows + for positive numeric values +
    scientific Uses scientific notation for floating point values +
    fixed Uses fixed-point notation for floating point values +
    +

    Note that unless bin, oct, dec, or hex is set, the +input base is octal if the value starts with 0, hexadecimal if it +starts with 0x, binary if it starts with 0b, and decimal +otherwise. +

    See also setf() and unsetf(). + +

    int TQTextStream::flags ( int f ) +

    + +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Sets the stream flags to f. Returns the previous stream flags. +

    See also setf() and unsetf(). + +

    TQTextStream & TQTextStream::operator<< ( TQChar c ) +

    +Writes character char to the stream and returns a reference to +the stream. +

    The character c is assumed to be Latin1 encoded independent of +the Encoding set for the TQTextStream. + +

    TQTextStream & TQTextStream::operator<< ( char c ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes character c to the stream and returns a reference to the +stream. + +

    TQTextStream & TQTextStream::operator<< ( signed short i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes a short integer i to the stream and returns a +reference to the stream. + +

    TQTextStream & TQTextStream::operator<< ( unsigned short i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes an unsigned short integer i to the stream and +returns a reference to the stream. + +

    TQTextStream & TQTextStream::operator<< ( signed int i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes an int i to the stream and returns a reference to the +stream. + +

    TQTextStream & TQTextStream::operator<< ( unsigned int i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes an unsigned int i to the stream and returns a +reference to the stream. + +

    TQTextStream & TQTextStream::operator<< ( signed long i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes a long int i to the stream and returns a reference +to the stream. + +

    TQTextStream & TQTextStream::operator<< ( unsigned long i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes an unsigned long int i to the stream and +returns a reference to the stream. + +

    TQTextStream & TQTextStream::operator<< ( float f ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes a float f to the stream and returns a reference to +the stream. + +

    TQTextStream & TQTextStream::operator<< ( double f ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes a double f to the stream and returns a reference to +the stream. + +

    TQTextStream & TQTextStream::operator<< ( const char * s ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes a string to the stream and returns a reference to the +stream. +

    The string s is assumed to be Latin1 encoded independent of the +Encoding set for the TQTextStream. + +

    TQTextStream & TQTextStream::operator<< ( const TQString & s ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes s to the stream and returns a reference to the stream. + +

    TQTextStream & TQTextStream::operator<< ( const TQCString & s ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes s to the stream and returns a reference to the stream. +

    The string s is assumed to be Latin1 encoded independent of the +Encoding set for the TQTextStream. + +

    TQTextStream & TQTextStream::operator<< ( void * ptr ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Writes a pointer to the stream and returns a reference to the +stream. +

    The ptr is output as an unsigned long hexadecimal integer. + +

    TQTextStream & TQTextStream::operator>> ( TQChar & c ) +

    +Reads a char c from the stream and returns a reference to the +stream. Note that whitespace is not skipped. + +

    TQTextStream & TQTextStream::operator>> ( char & c ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a char c from the stream and returns a reference to the +stream. Note that whitespace is skipped. + +

    TQTextStream & TQTextStream::operator>> ( signed short & i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a signed short integer i from the stream and returns a +reference to the stream. See flags() for an explanation of the +expected input format. + +

    TQTextStream & TQTextStream::operator>> ( unsigned short & i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads an unsigned short integer i from the stream and +returns a reference to the stream. See flags() for an explanation +of the expected input format. + +

    TQTextStream & TQTextStream::operator>> ( signed int & i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a signed int i from the stream and returns a reference +to the stream. See flags() for an explanation of the expected +input format. + +

    TQTextStream & TQTextStream::operator>> ( unsigned int & i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads an unsigned int i from the stream and returns a +reference to the stream. See flags() for an explanation of the +expected input format. + +

    TQTextStream & TQTextStream::operator>> ( signed long & i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a signed long int i from the stream and returns a +reference to the stream. See flags() for an explanation of the +expected input format. + +

    TQTextStream & TQTextStream::operator>> ( unsigned long & i ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads an unsigned long int i from the stream and returns a +reference to the stream. See flags() for an explanation of the +expected input format. + +

    TQTextStream & TQTextStream::operator>> ( float & f ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a float f from the stream and returns a reference to +the stream. See flags() for an explanation of the expected input +format. + +

    TQTextStream & TQTextStream::operator>> ( double & f ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a double f from the stream and returns a reference to +the stream. See flags() for an explanation of the expected input +format. + +

    TQTextStream & TQTextStream::operator>> ( char * s ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a "word" from the stream into s and returns a reference +to the stream. +

    A word consists of characters for which isspace() returns FALSE. + +

    TQTextStream & TQTextStream::operator>> ( TQString & str ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a "word" from the stream into str and returns a reference +to the stream. +

    A word consists of characters for which isspace() returns FALSE. + +

    TQTextStream & TQTextStream::operator>> ( TQCString & str ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Reads a "word" from the stream into str and returns a reference +to the stream. +

    A word consists of characters for which isspace() returns FALSE. + +

    int TQTextStream::precision () const +

    + +

    Returns the precision. The default value is 6. + +

    int TQTextStream::precision ( int p ) +

    + +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Sets the precision to p. Returns the previous precision setting. + +

    TQString TQTextStream::read () +

    +Reads the entire stream from the current position, and returns a string +containing the text. +

    See also TQIODevice::readLine(). + +

    Examples: action/application.cpp, application/application.cpp, mdi/application.cpp, qdir/qdir.cpp, and qwerty/qwerty.cpp. +

    TQString TQTextStream::readLine () +

    +Reads a line from the stream and returns a string containing the +text. +

    The returned string does not contain any trailing newline or +carriage return. Note that this is different from +TQIODevice::readLine(), which does not strip the newline at the end +of the line. +

    On EOF you will get a TQString that is null. On reading an empty +line the returned TQString is empty but not null. +

    See also TQIODevice::readLine(). + +

    Examples: addressbook/centralwidget.cpp, chart/element.cpp, and network/clientserver/server/server.cpp. +

    TQTextStream & TQTextStream::readRawBytes ( char * s, uint len ) +

    +Reads len bytes from the stream into s and returns a +reference to the stream. +

    The buffer s must be preallocated. +

    Note that no encoding is done by this function. +

    Warning: The behavior of this function is undefined unless the +stream's encoding is set to Unicode or Latin1. +

    See also TQIODevice::readBlock(). + +

    void TQTextStream::reset () +

    +Resets the text stream. +

      +
    • All flags are set to 0. +
    • The field width is set to 0. +
    • The fill character is set to ' ' (Space). +
    • The precision is set to 6. +
    +

    See also setf(), width(), fill(), and precision(). + +

    void TQTextStream::setCodec ( TQTextCodec * codec ) +

    +Sets the codec for this stream to codec. Will not try to +autodetect Unicode. +

    Note that this function should be called before any data is read +to/written from the stream. +

    See also setEncoding() and codec(). + +

    Example: qwerty/qwerty.cpp. +

    void TQTextStream::setDevice ( TQIODevice * iod ) +

    +Sets the IO device to iod. +

    See also device() and unsetDevice(). + +

    void TQTextStream::setEncoding ( Encoding e ) +

    +Sets the encoding of this stream to e, where e is one of the +following values: +
    +
    Encoding Meaning +
    Locale +Uses local file format (Latin1 if locale is not set), but +autodetecting Unicode(utf16) on input. +
    Unicode +Uses Unicode(utf16) for input and output. Output will be +written in the order most efficient for the current platform +(i.e. the order used internally in TQString). +
    UnicodeUTF8 +Using Unicode(utf8) for input and output. If you use it for +input it will autodetect utf16 and use it instead of utf8. +
    Latin1 +ISO-8859-1. Will not autodetect utf16. +
    UnicodeNetworkOrder +Uses network order Unicode(utf16) for input and output. +Useful when reading Unicode data that does not start with the +byte order marker. +
    UnicodeReverse +Uses reverse network order Unicode(utf16) for input and +output. Useful when reading Unicode data that does not start +with the byte order marker or when writing data that should be +read by buggy Windows applications. +
    RawUnicode +Like Unicode, but does not write the byte order marker nor +does it auto-detect the byte order. Useful only when writing to +non-persistent storage used by a single process. +
    +

    Locale and all Unicode encodings, except RawUnicode, will look +at the first two bytes in an input stream to determine the byte +order. The initial byte order marker will be stripped off before +data is read. +

    Note that this function should be called before any data is read to +or written from the stream. +

    See also setCodec(). + +

    Examples: addressbook/centralwidget.cpp, network/httpd/httpd.cpp, and qwerty/qwerty.cpp. +

    int TQTextStream::setf ( int bits ) +

    + +

    Sets the stream flag bits bits. Returns the previous stream +flags. +

    Equivalent to flags( flags() | bits ). +

    See also unsetf(). + +

    int TQTextStream::setf ( int bits, int mask ) +

    + +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Sets the stream flag bits bits with a bit mask mask. Returns +the previous stream flags. +

    Equivalent to flags( (flags() & ~mask) | (bits & mask) ). +

    See also unsetf(). + +

    void TQTextStream::skipWhiteSpace () +

    +Positions the read pointer at the first non-whitespace character. + +

    void TQTextStream::unsetDevice () +

    +Unsets the IO device. Equivalent to setDevice( 0 ). +

    See also device() and setDevice(). + +

    int TQTextStream::unsetf ( int bits ) +

    + +

    Clears the stream flag bits bits. Returns the previous stream +flags. +

    Equivalent to flags( flags() & ~mask ). +

    See also setf(). + +

    int TQTextStream::width () const +

    + +

    Returns the field width. The default value is 0. + +

    int TQTextStream::width ( int w ) +

    + +

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Sets the field width to w. Returns the previous field width. + +

    TQTextStream & TQTextStream::writeRawBytes ( const char * s, uint len ) +

    +Writes the len bytes from s to the stream and returns a +reference to the stream. +

    Note that no encoding is done by this function. +

    See also TQIODevice::writeBlock(). + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextview-h.html b/doc/html/tqtextview-h.html new file mode 100644 index 00000000..c0aac327 --- /dev/null +++ b/doc/html/tqtextview-h.html @@ -0,0 +1,119 @@ + + + + + +tqtextview.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqtextview.h

    + +

    This is the verbatim text of the tqtextview.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqtextview.h   3.3.8   edited Jan 11 14:39 $
    +**
    +** Definition of the TQTextView class
    +**
    +** Created : 990101
    +**
    +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the widgets module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial licenses may use this file in accordance with the TQt
    +** Commercial License Agreement provided with the Software.
    +**
    +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQTEXTVIEW_H
    +#define TQTEXTVIEW_H
    +
    +#ifndef QT_H
    +#include "tqtextedit.h"
    +#endif // QT_H
    +
    +#ifndef TQT_NO_TEXTVIEW
    +
    +class TQ_EXPORT TQTextView : public TQTextEdit
    +{
    +    TQ_OBJECT
    +    TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false )
    +    TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false )
    +    TQ_OVERRIDE( bool modified SCRIPTABLE false)
    +    TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false )
    +    TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false )
    +
    +public:
    +    TQTextView( const TQString& text, const TQString& context = TQString::null,
    +	       TQWidget* parent=0, const char* name=0);
    +    TQTextView( TQWidget* parent=0, const char* name=0 );
    +
    +    virtual ~TQTextView();
    +
    +private:
    +#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator=
    +    TQTextView( const TQTextView & );
    +    TQTextView &operator=( const TQTextView & );
    +#endif
    +};
    +
    +#endif //TQT_NO_TEXTVIEW
    +#endif //TQTEXTVIEW_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextview-members.html b/doc/html/tqtextview-members.html new file mode 100644 index 00000000..cd6afef6 --- /dev/null +++ b/doc/html/tqtextview-members.html @@ -0,0 +1,543 @@ + + + + + +TQTextView Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQTextView

    + +

    This is the complete list of member functions for +TQTextView, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqtextview.html b/doc/html/tqtextview.html new file mode 100644 index 00000000..8997dc2e --- /dev/null +++ b/doc/html/tqtextview.html @@ -0,0 +1,81 @@ + + + + + +TQTextView Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQTextView Class Reference
    [obsolete]

    + +

    The TQTextView class provides a rich-text viewer. +More... +

    #include <tqtextview.h> +

    Inherits TQTextEdit. +

    List of all member functions. +

    Properties

    +
      +
    • bool modified - whether the text view's contents have been modified  (read only)
    • +
    • bool overwriteMode - whether new text overwrites or pushes aside existing text  (read only)
    • +
    • bool readOnly - whether the text view's contents are read only  (read only)
    • +
    • int undoDepth - the number of undoable steps  (read only)
    • +
    • bool undoRedoEnabled - whether undo and redo are enabled  (read only)
    • +
    +

    Detailed Description

    + +The TQTextView class provides a rich-text viewer. +

    This class is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

    This class wraps a read-only TQTextEdit. +Use a TQTextEdit instead, and call setReadOnly(TRUE) +to disable editing. + +


    Property Documentation

    +

    bool modified

    +

    This property holds whether the text view's contents have been modified. +

    +

    bool overwriteMode

    +

    This property holds whether new text overwrites or pushes aside existing text. +

    +

    bool readOnly

    +

    This property holds whether the text view's contents are read only. +

    +

    int undoDepth

    +

    This property holds the number of undoable steps. +

    +

    bool undoRedoEnabled

    +

    This property holds whether undo and redo are enabled. +

    +

    +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqwidget.html b/doc/html/tqwidget.html index 4da38584..291594fe 100644 --- a/doc/html/tqwidget.html +++ b/doc/html/tqwidget.html @@ -923,7 +923,7 @@ This event handler is called when a drag is in progress and the mouse enters this widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDragEnterEvent. +

    See also TQTextDrag, TQImageDrag, and TQDragEnterEvent.

    Example: iconview/simple_dd/main.cpp.

    void TQWidget::dragLeaveEvent ( TQDragLeaveEvent * ) [virtual protected] @@ -932,7 +932,7 @@ This event handler is called when a drag is in progress and the mouse leaves this widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDragLeaveEvent. +

    See also TQTextDrag, TQImageDrag, and TQDragLeaveEvent.

    void TQWidget::dragMoveEvent ( TQDragMoveEvent * ) [virtual protected]

    @@ -940,7 +940,7 @@ This event handler is called when a drag is in progress and the mouse enters this widget, and whenever it moves within the widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDragMoveEvent. +

    See also TQTextDrag, TQImageDrag, and TQDragMoveEvent.

    void TQWidget::drawText ( int x, int y, const TQString & str )

    @@ -962,7 +962,7 @@ This event handler is called when the drag is dropped on this widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDropEvent. +

    See also TQTextDrag, TQImageDrag, and TQDropEvent.

    Example: iconview/simple_dd/main.cpp.

    void TQWidget::enabledChange ( bool oldEnabled ) [virtual protected] @@ -1235,7 +1235,7 @@ Returns the preferred height for this widget, given the width w. The de preferred height does not depend on the width.

    Warning: Does not look at the widget's layout. -

    Reimplemented in TQMenuBar and TQTextEdit. +

    Reimplemented in TQMenuBar and TQTextEdit.

    void TQWidget::hide () [virtual slot]

    Hides the widget. @@ -1395,7 +1395,7 @@ presses Esc. Otherwise the event is ignored.

    See also keyReleaseEvent(), TQKeyEvent::ignore(), focusPolicy, focusInEvent(), focusOutEvent(), event(), and TQKeyEvent.

    Example: picture/picture.cpp. -

    Reimplemented in TQLineEdit and TQTextEdit. +

    Reimplemented in TQLineEdit and TQTextEdit.

    void TQWidget::keyReleaseEvent ( TQKeyEvent * e ) [virtual protected]

    This event handler, for event e, can be reimplemented in a @@ -2046,7 +2046,7 @@ See the "inputMethodEnabled" Enables key event compression, if compress is TRUE, and disables it if compress is FALSE.

    Key compression is off by default (except for TQLineEdit and -TQTextEdit), so widgets receive one key press event for each key +TQTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to compress key events so that more than one character can be diff --git a/doc/html/tqxml-h.html b/doc/html/tqxml-h.html index f8aadfaf..c1d6c0e3 100644 --- a/doc/html/tqxml-h.html +++ b/doc/html/tqxml-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQXML_H #ifndef QT_H -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqfile.h" #include "tqstring.h" #include "tqstringlist.h" diff --git a/doc/html/tqxmlinputsource.html b/doc/html/tqxmlinputsource.html index 5285e593..bf0d34ce 100644 --- a/doc/html/tqxmlinputsource.html +++ b/doc/html/tqxmlinputsource.html @@ -108,7 +108,7 @@ source will contain no data.

    Constructs an input source and gets the data from the file file. If the file cannot be read the input source is empty. -

    TQXmlInputSource::TQXmlInputSource ( TQTextStream & stream ) +

    TQXmlInputSource::TQXmlInputSource ( TQTextStream & stream )

    This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

    Constructs an input source and gets the data from the text stream stream. diff --git a/doc/html/tutorial2-03.html b/doc/html/tutorial2-03.html index 4cdcb496..04cc3f1c 100644 --- a/doc/html/tutorial2-03.html +++ b/doc/html/tutorial2-03.html @@ -153,8 +153,8 @@ index; (see Debugging).

    (Extracts from element.h.)

    -

        TQTextStream &operator<<( TQTextStream&, const Element& );
    -    TQTextStream &operator>>( TQTextStream&, Element& );
    +
        TQTextStream &operator<<( TQTextStream&, const Element& );
    +    TQTextStream &operator>>( TQTextStream&, Element& );
     

    To make our Element class more self-contained we provide overloads for the << and >> operators so that Elements may be written to @@ -168,9 +168,9 @@ filter the data using a scripting language.

        #include "element.h"
     
         #include <tqstringlist.h>
    -    #include <ntqtextstream.h>
    +    #include <tqtextstream.h>
     
    -

    Our implementation of the operators requires the inclusion of ntqtextstream.h and tqstringlist.h. +

    Our implementation of the operators requires the inclusion of tqtextstream.h and tqstringlist.h.

        const char FIELD_SEP = ':';
         const char PROPOINT_SEP = ';';
         const char XY_SEP = ',';
    @@ -190,7 +190,7 @@ label text. For example:
      
     

    There's no problem having whitespace and field separators in label text due to the way we read Element data. -

        TQTextStream &operator<<( TQTextStream &s, const Element &element )
    +

        TQTextStream &operator<<( TQTextStream &s, const Element &element )
         {
             s << element.value() << FIELD_SEP
               << element.valueColor().name() << FIELD_SEP
    @@ -210,9 +210,9 @@ text due to the way we read Element data.
     

    Writing elements is straight-forward. Each member is written followed by a field separator. The points are written as comma separated (XY_SEP) x, y pairs, each pair separated by the PROPOINT_SEP separator. The final field is the label followed by a newline. -

        TQTextStream &operator>>( TQTextStream &s, Element &element )
    +

        TQTextStream &operator>>( TQTextStream &s, Element &element )
         {
    -        TQString data = s.readLine();
    +        TQString data = s.readLine();
             element.setValue( Element::INVALID );
     
             int errors = 0;
    diff --git a/doc/html/tutorial2-07.html b/doc/html/tutorial2-07.html
    index b0cc1e31..3ff6dc9b 100644
    --- a/doc/html/tutorial2-07.html
    +++ b/doc/html/tutorial2-07.html
    @@ -49,11 +49,11 @@ body { background: #ffffff; color: black; }
     
             init(); // Make sure we have colours
             m_filename = filename;
    -        TQTextStream ts( &file );
    +        TQTextStream ts( &file );
             Element element;
             int errors = 0;
             int i = 0;
    -        while ( !ts.eof() ) {
    +        while ( !ts.eof() ) {
                 ts >> element;
                 if ( element.isValid() )
                     m_elements[i++] = element;
    @@ -81,7 +81,7 @@ draw the chart and mark it as unchanged.
                                         arg( m_filename ), 2000 );
                 return;
             }
    -        TQTextStream ts( &file );
    +        TQTextStream ts( &file );
             for ( int i = 0; i < MAX_ELEMENTS; ++i )
                 if ( m_elements[i].isValid() )
                     ts << m_elements[i];
    diff --git a/doc/html/unicode.html b/doc/html/unicode.html
    index 5de9d2d4..075e0486 100644
    --- a/doc/html/unicode.html
    +++ b/doc/html/unicode.html
    @@ -63,7 +63,7 @@ update and
     

    In TQt, and in most applications that use TQt, most or all user-visible strings are stored using Unicode. TQt provides:

      -

    • Translation to/from legacy encodings for file I/O: see TQTextCodec and TQTextStream. +

    • Translation to/from legacy encodings for file I/O: see TQTextCodec and TQTextStream.
    • Translation from Input Methods and 8-bit keyboard input.
    • Translation to legacy character sets for on-screen display.
    • A string class, TQString, that stores Unicode characters, with @@ -76,7 +76,7 @@ even on Windows platforms that do not support it natively.

    To fully benefit from Unicode, we recommend using TQString for storing all user-visible strings, and performing all text file I/O using -TQTextStream. Use TQKeyEvent::text() for keyboard input in any custom +TQTextStream. Use TQKeyEvent::text() for keyboard input in any custom widgets you write; it does not make much difference for slow typists in Western Europe or North America, but for fast typists or people using special input methods using text() is beneficial. @@ -96,7 +96,7 @@ translation support, like this:

    tr() (simplifying somewhat) maps from const char * to a Unicode string, and uses installable TQTranslator objects to do the mapping. -

    TQt provides a number of built-in TQTextCodec classes, that is, +

    TQt provides a number of built-in TQTextCodec classes, that is, classes that know how to translate between Unicode and legacy encodings to support programs that must talk to other programs or read/write files in legacy file formats. diff --git a/doc/html/whatsthis b/doc/html/whatsthis index 24dcf0c3..370f55ab 100644 --- a/doc/html/whatsthis +++ b/doc/html/whatsthis @@ -9,7 +9,7 @@ Abstract base for Qt/Embedded keyboard driver plugins. | QKbdDriverPlugin Abstract base for Qt/Embedded mouse driver plugins. | QMouseDriverPlugin Abstract base for custom TQSqlDriver plugins. | TQSqlDriverPlugin Abstract base for custom QStyle plugins. | QStylePlugin -Abstract base for custom QTextCodec plugins. | QTextCodecPlugin +Abstract base for custom TQTextCodec plugins. | TQTextCodecPlugin Abstract base for custom TQWidget plugins. | TQWidgetPlugin Abstract base for custom image format plugins. | TQImageFormatPlugin Abstract base for fixed-size grids. | QGridView @@ -43,8 +43,8 @@ Array of bytes. | QByteArray Array of points. | QPointArray Asynchronous DNS lookups. | QDns Base class for QMenuBar and QPopupMenu. | QMenuData -Base class for implementing QTextEdit syntax highlighters. | QSyntaxHighlighter -Basic functions for reading and writing text using a TQIODevice. | QTextStream +Base class for implementing TQTextEdit syntax highlighters. | QSyntaxHighlighter +Basic functions for reading and writing text using a TQIODevice. | TQTextStream Blank space in a layout. | QSpacerItem Bridge between application objects and script code. | QAxScriptManager Browsing and editing of SQL tables and views. | TQSqlCursor @@ -72,9 +72,9 @@ Common operations for network protocols. | QNetworkOperation Common operations on URLs. | QUrlOperator Communication capabilities between several clients. | QCopChannel Const iterator for TQValueList. | TQValueListConstIterator -Convenience class for input streams. | QTextIStream -Convenience class for output streams. | QTextOStream -Conversion between text encodings. | QTextCodec +Convenience class for input streams. | TQTextIStream +Convenience class for output streams. | TQTextOStream +Conversion between text encodings. | TQTextCodec Conversion to and from EUC-JP character sets. | QEucJpCodec Conversion to and from EUC-KR character sets. | QEucKrCodec Conversion to and from JIS character sets. | QJisCodec @@ -118,7 +118,7 @@ Doubly-linked list of char*. | TQStrList Doubly-linked list of char* with case-insensitive comparison. | TQStrIList Drag and drop object for transferring colors. | QColorDrag Drag and drop object for transferring images. | TQImageDrag -Drag and drop object for transferring plain and Unicode text. | QTextDrag +Drag and drop object for transferring plain and Unicode text. | TQTextDrag Drag object for a list of URI references. | QUriDrag Ellipse or ellipse segment on a TQCanvas. | TQCanvasEllipse Encapsulates MIME-based data transfer. | QDragObject @@ -282,7 +282,7 @@ Platform-independent threads. | QThread Polygon on a TQCanvas. | TQCanvasPolygon Polygonal canvas item on a TQCanvas. | TQCanvasPolygonalItem Popup menu widget. | QPopupMenu -Powerful single-page rich text editor. | QTextEdit +Powerful single-page rich text editor. | TQTextEdit TQObject that is a web browser plugin. | QNPInstance TQObject that wraps a COM object. | QAxObject TQPtrList of TQObjects. | TQObjectList @@ -306,7 +306,7 @@ Represents one element in the DOM tree. | TQDomElement Represents text data in the parsed XML document. | TQDomText Request header information for HTTP. | QHttpRequestHeader Response header information for HTTP. | QHttpResponseHeader -Rich text browser with hypertext navigation. | QTextBrowser +Rich text browser with hypertext navigation. | TQTextBrowser Robust integer semaphore. | QSemaphore Rounded range control (like a speedometer or potentiometer). | QDial SGI/Irix look and feel. | QSGIStyle @@ -329,8 +329,8 @@ Splash screen that can be shown during application startup. | QSplashScreen Stack of tabbed widgets. | QTabDialog Stack of tabbed widgets. | QTabWidget Stack of widgets of which only the top widget is user-visible. | TQWidgetStack -State-based decoder. | QTextDecoder -State-based encoder. | QTextEncoder +State-based decoder. | TQTextDecoder +State-based encoder. | TQTextEncoder Stores information about URLs. | QUrlInfo Stores meta data about a property. | QMetaProperty Stores meta data associated with a SQL field. | TQSqlFieldInfo diff --git a/doc/i18n.doc b/doc/i18n.doc index 6ff7ce4a..fec6ef57 100644 --- a/doc/i18n.doc +++ b/doc/i18n.doc @@ -121,7 +121,7 @@ the fl and fi ligatures used in typesetting US and European books. Qt tries to take care of all the special features listed above. You usually don't have to worry about these features so long as you use -Qt's input widgets (e.g. QLineEdit, QTextEdit, and derived classes) +Qt's input widgets (e.g. QLineEdit, TQTextEdit, and derived classes) and Qt's display widgets (e.g. QLabel). Support for these writing systems is transparent to the programmer @@ -143,7 +143,7 @@ string. In some languages (e.g. Arabic or languages from the Indian subcontinent), the width and shape of a glyph changes depending on the surrounding characters. Writing input controls usually requires a certain knowledge of the scripts it is going to be used in. Usually -the easiest way is to subclass QLineEdit or QTextEdit. +the easiest way is to subclass QLineEdit or TQTextEdit. \endlist @@ -403,12 +403,12 @@ Typically, your application's main() function will look like this: // translation file for Qt QTranslator qt( 0 ); - qt.load( TQString( "qt_" ) + QTextCodec::locale(), "." ); + qt.load( TQString( "qt_" ) + TQTextCodec::locale(), "." ); app.installTranslator( &qt ); // translation file for application strings QTranslator myapp( 0 ); - myapp.load( TQString( "myapp_" ) + QTextCodec::locale(), "." ); + myapp.load( TQString( "myapp_" ) + TQTextCodec::locale(), "." ); app.installTranslator( &myapp ); ... @@ -419,7 +419,7 @@ Typically, your application's main() function will look like this: \section2 Support for Encodings -The QTextCodec class and the facilities in QTextStream make it easy to +The TQTextCodec class and the facilities in TQTextStream make it easy to support many input and output encodings for your users' data. When an application starts, the locale of the machine will determine the 8-bit encoding used when dealing with 8-bit data: such as for font @@ -434,7 +434,7 @@ would be: \code TQString string = ...; // some Unicode text - QTextCodec* codec = QTextCodec::codecForName( "ISO 8859-5" ); + TQTextCodec* codec = TQTextCodec::codecForName( "ISO 8859-5" ); QCString encoded_string = codec->fromUnicode( string ); ...; // use encoded_string in 8-bit operations @@ -455,7 +455,7 @@ conversion: \code QCString encoded_string = ...; // Some ISO 8859-5 encoded text. - QTextCodec* codec = QTextCodec::codecForName("ISO 8859-5"); + TQTextCodec* codec = TQTextCodec::codecForName("ISO 8859-5"); TQString string = codec->toUnicode(encoded_string); ...; // Use string in all of Qt's TQString operations. @@ -468,23 +468,23 @@ need to process existing documents. In general, Unicode (UTF-16 or UTF-8) is best for information transferred between arbitrary people, while within a language or national group, a local standard is often more appropriate. The most important encoding to support is the one -returned by QTextCodec::codecForLocale(), as this is the one the user +returned by TQTextCodec::codecForLocale(), as this is the one the user is most likely to need for communicating with other people and applications (this is the codec used by local8Bit()). Qt supports most of the more frequently used encodings natively. For a -complete list of supported encodings see the \l QTextCodec +complete list of supported encodings see the \l TQTextCodec documentation. In some cases and for less frequently used encodings it may be -necessary to write your own QTextCodec subclass. Depending on the +necessary to write your own TQTextCodec subclass. Depending on the urgency, it may be useful to contact Trolltech technical support or ask on the \c qt-interest mailing list to see if someone else is already working on supporting the encoding. A useful interim measure -can be to use the QTextCodec::loadCharmapFile() function to build a +can be to use the TQTextCodec::loadCharmapFile() function to build a data-driven codec, although this approach has a memory and speed penalty, especially with dynamically loaded libraries. For details of -writing your own QTextCodec, see the main QTextCodec class +writing your own TQTextCodec, see the main TQTextCodec class documentation. \keyword localization @@ -561,7 +561,7 @@ not be too concerned with platform-specific limitations. (see QFile::setEncodingFunction() to explore alternative encodings). \i File I/O defaults to the local 8-bit encoding, - with Unicode options in QTextStream. + with Unicode options in TQTextStream. \endlist \section2 Windows @@ -569,7 +569,7 @@ not be too concerned with platform-specific limitations. \list \i TQt provides full Unicode support, including input methods, fonts, clipboard, drag-and-drop and file names. -\i File I/O defaults to Latin-1, with Unicode options in QTextStream. +\i File I/O defaults to Latin-1, with Unicode options in TQTextStream. Note that some Windows programs do not understand big-endian Unicode text files even though that is the order prescribed by the Unicode Standard in the absence of higher-level protocols. diff --git a/doc/man/man3/tqapplication.3qt b/doc/man/man3/tqapplication.3qt index 582175ac..37c4ea97 100644 --- a/doc/man/man3/tqapplication.3qt +++ b/doc/man/man3/tqapplication.3qt @@ -91,10 +91,10 @@ Inherits TQObject. .BI "virtual bool \fBnotify\fR ( TQObject * receiver, QEvent * e )" .br .ti -1c -.BI "void setDefaultCodec ( QTextCodec * codec ) \fI(obsolete)\fR" +.BI "void setDefaultCodec ( TQTextCodec * codec ) \fI(obsolete)\fR" .br .ti -1c -.BI "QTextCodec * defaultCodec () const \fI(obsolete)\fR" +.BI "TQTextCodec * defaultCodec () const \fI(obsolete)\fR" .br .ti -1c .BI "void \fBinstallTranslator\fR ( QTranslator * mf )" @@ -487,7 +487,7 @@ See setColorSpec() for full details. .SH "QApplication::Encoding" This enum type defines the 8-bit encoding of character string arguments to translate(): .TP -\fCQApplication::DefaultCodec\fR - the encoding specified by QTextCodec::codecForTr() (Latin-1 if none has been set) +\fCQApplication::DefaultCodec\fR - the encoding specified by TQTextCodec::codecForTr() (Latin-1 if none has been set) .TP \fCQApplication::UnicodeUTF8\fR - UTF-8 .PP @@ -837,10 +837,10 @@ The default value on X11 is 1000 milliseconds. On Windows, the control panel val Widgets should not cache this value since it may be changed at any time by the user changing the global desktop settings. .PP See also setCursorFlashTime(). -.SH "QTextCodec * QApplication::defaultCodec () const" +.SH "TQTextCodec * QApplication::defaultCodec () const" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -Returns QTextCodec::codecForTr(). +Returns TQTextCodec::codecForTr(). .SH "QDesktopWidget * QApplication::desktop ()\fC [static]\fR" Returns the desktop widget (also called the root window). .PP @@ -1300,10 +1300,10 @@ Sets the text cursor's flash (blink) time to \fImsecs\fR milliseconds. The flash Note that on Microsoft Windows, calling this function sets the cursor flash time for all windows. .PP See also cursorFlashTime(). -.SH "void QApplication::setDefaultCodec ( QTextCodec * codec )" +.SH "void QApplication::setDefaultCodec ( TQTextCodec * codec )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -This is the same as QTextCodec::setCodecForTr(). +This is the same as TQTextCodec::setCodecForTr(). .SH "void QApplication::setDesktopSettingsAware ( bool on )\fC [static]\fR" By default, TQt will try to use the current standard colors, fonts etc., from the underlying window system's desktop settings, and use them for all relevant widgets. This behavior can be switched off by calling this function with \fIon\fR set to FALSE. .PP @@ -1527,7 +1527,7 @@ See also setStartDragDistance(), startDragTime(), and QPoint::manhattanLength(). .SH "int QApplication::startDragTime ()\fC [static]\fR" If you support drag and drop in you application and a drag should start after a mouse click and after a certain time elapsed, you should use the value which this method returns as the delay (in ms). .PP -Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for starting a drag. +Qt also uses this delay internally, e.g. in TQTextEdit and QLineEdit, for starting a drag. .PP The default value is 500 ms. .PP diff --git a/doc/man/man3/tqaxbase.3qt b/doc/man/man3/tqaxbase.3qt index c01d3eb1..51d6f4d8 100644 --- a/doc/man/man3/tqaxbase.3qt +++ b/doc/man/man3/tqaxbase.3qt @@ -339,7 +339,7 @@ The QVariant objects in \fIvars\fR are updated when the method has out-parameter .SH "void QAxBase::exception ( int code, const TQString & source, const TQString & desc, const TQString & help )\fC [signal]\fR" This signal is emitted when the COM object throws an exception while called using the OLE automation interface IDispatch. \fIcode\fR, \fIsource\fR, \fIdesc\fR and \fIhelp\fR provide information about the exception as provided by the COM server and can be used to provide useful feedback to the end user. \fIhelp\fR includes the help file, and the help context ID in brackets, e.g. "filename [id]". .SH "TQString QAxBase::generateDocumentation ()" -Returns a rich text string with documentation for the wrapped COM object. Dump the string to an HTML-file, or use it in e.g. a QTextBrowser widget. +Returns a rich text string with documentation for the wrapped COM object. Dump the string to an HTML-file, or use it in e.g. a TQTextBrowser widget. .SH "bool QAxBase::initialize ( IUnknown ** ptr )\fC [virtual protected]\fR" This virtual function is called by setControl() and creates the requested COM object. \fIptr\fR is set to the object's IUnknown implementation. The function returns TRUE if the object initialization succeeded; otherwise the function returns FALSE. .PP diff --git a/doc/man/man3/tqbig5codec.3qt b/doc/man/man3/tqbig5codec.3qt index a31e869f..81c93dc1 100644 --- a/doc/man/man3/tqbig5codec.3qt +++ b/doc/man/man3/tqbig5codec.3qt @@ -11,7 +11,7 @@ QBig5Codec \- Conversion to and from the Big5 encoding .SH SYNOPSIS \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SH DESCRIPTION The QBig5Codec class provides conversion to and from the Big5 encoding. diff --git a/doc/man/man3/tqbig5hkscscodec.3qt b/doc/man/man3/tqbig5hkscscodec.3qt index c263b177..e02c8f59 100644 --- a/doc/man/man3/tqbig5hkscscodec.3qt +++ b/doc/man/man3/tqbig5hkscscodec.3qt @@ -11,7 +11,7 @@ QBig5hkscsCodec \- Conversion to and from the Big5-HKSCS encoding .SH SYNOPSIS \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SH DESCRIPTION The QBig5hkscsCodec class provides conversion to and from the Big5-HKSCS encoding. diff --git a/doc/man/man3/tqbuffer.3qt b/doc/man/man3/tqbuffer.3qt index 1b0b5b1e..150ee624 100644 --- a/doc/man/man3/tqbuffer.3qt +++ b/doc/man/man3/tqbuffer.3qt @@ -42,19 +42,19 @@ Inherits TQIODevice. .SH DESCRIPTION The QBuffer class is an I/O device that operates on a QByteArray. .PP -QBuffer is used to read and write to a memory buffer. It is normally used with a QTextStream or a QDataStream. QBuffer has an associated QByteArray which holds the buffer data. The size() of the buffer is automatically adjusted as data is written. +QBuffer is used to read and write to a memory buffer. It is normally used with a TQTextStream or a QDataStream. QBuffer has an associated QByteArray which holds the buffer data. The size() of the buffer is automatically adjusted as data is written. .PP The constructor \fCQBuffer(QByteArray)\fR creates a QBuffer using an existing byte array. The byte array can also be set with setBuffer(). Writing to the QBuffer will modify the original byte array because QByteArray is explicitly shared. .PP Use open() to open the buffer before use and to set the mode (read-only, write-only, etc.). close() closes the buffer. The buffer must be closed before reopening or calling setBuffer(). .PP -A common way to use QBuffer is through QDataStream or QTextStream, which have constructors that take a QBuffer parameter. For convenience, there are also QDataStream and QTextStream constructors that take a QByteArray parameter. These constructors create and open an internal QBuffer. +A common way to use QBuffer is through QDataStream or TQTextStream, which have constructors that take a QBuffer parameter. For convenience, there are also QDataStream and TQTextStream constructors that take a QByteArray parameter. These constructors create and open an internal QBuffer. .PP -Note that QTextStream can also operate on a TQString (a Unicode string); a QBuffer cannot. +Note that TQTextStream can also operate on a TQString (a Unicode string); a QBuffer cannot. .PP You can also use QBuffer directly through the standard TQIODevice functions readBlock(), writeBlock() readLine(), at(), getch(), putch() and ungetch(). .PP -See also QFile, QDataStream, QTextStream, QByteArray, Shared Classes, Collection Classes, and Input/Output and Networking. +See also QFile, QDataStream, TQTextStream, QByteArray, Shared Classes, Collection Classes, and Input/Output and Networking. .SH MEMBER FUNCTION DOCUMENTATION .SH "QBuffer::QBuffer ()" Constructs an empty buffer. diff --git a/doc/man/man3/tqdatastream.3qt b/doc/man/man3/tqdatastream.3qt index df268349..f72920e1 100644 --- a/doc/man/man3/tqdatastream.3qt +++ b/doc/man/man3/tqdatastream.3qt @@ -159,7 +159,7 @@ The QDataStream class provides serialization of binary data to a TQIODevice. .PP A data stream is a binary stream of encoded information which is 100% independent of the host computer's operating system, CPU or byte order. For example, a data stream that is written by a PC under Windows can be read by a Sun SPARC running Solaris. .PP -You can also use a data stream to read/write raw unencoded binary data. If you want a "parsing" input stream, see QTextStream. +You can also use a data stream to read/write raw unencoded binary data. If you want a "parsing" input stream, see TQTextStream. .PP The QDataStream class implements the serialization of C++'s basic data types, like \fCchar\fR, \fCshort\fR, \fCint\fR, \fCchar*\fR, etc. Serialization of more complex data is accomplished by breaking up the data into primitive units. .PP @@ -294,7 +294,7 @@ You may wish to read/write your own raw binary data to/from the data stream dire .PP A similar pair of functions is readBytes() and writeBytes(). These differ from their \fIraw\fR counterparts as follows: readBytes() reads a TQ_UINT32 which is taken to be the length of the data to be read, then that number of bytes is read into the preallocated char*; writeBytes() writes a TQ_UINT32 containing the length of the data, followed by the data. Notice that any encoding/decoding of the data (apart from the length TQ_UINT32) must be done by you. .PP -See also QTextStream, QVariant, and Input/Output and Networking. +See also TQTextStream, QVariant, and Input/Output and Networking. .SS "Member Type Documentation" .SH "QDataStream::ByteOrder" The byte order used for reading/writing the data. diff --git a/doc/man/man3/tqdockarea.3qt b/doc/man/man3/tqdockarea.3qt index c799b50d..d4ea200d 100644 --- a/doc/man/man3/tqdockarea.3qt +++ b/doc/man/man3/tqdockarea.3qt @@ -82,10 +82,10 @@ Inherits TQWidget. .SH RELATED FUNCTION DOCUMENTATION .in +1c .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( QTextStream & ts, const QDockArea & dockArea )" +.BI "TQTextStream & \fBoperator<<\fR ( TQTextStream & ts, const QDockArea & dockArea )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( QTextStream & ts, QDockArea & dockArea )" +.BI "TQTextStream & \fBoperator>>\fR ( TQTextStream & ts, QDockArea & dockArea )" .br .in -1c .SH DESCRIPTION @@ -107,9 +107,9 @@ The QDockArea class maintains a position list of all its child dock windows. Doc .PP To dock or undock a dock window use QDockWindow::dock() and QDockWindow::undock() respectively. If you want to control which dock windows can dock in a dock area use setAcceptDockWindow(). To see if a dock area contains a particular dock window use hasDockWindow(); to see how many dock windows a dock area contains use count(). .PP -The streaming operators can write the positions of the dock windows in the dock area to a QTextStream. The positions can be read back later to restore the saved positions. +The streaming operators can write the positions of the dock windows in the dock area to a TQTextStream. The positions can be read back later to restore the saved positions. .PP -Save the positions to a QTextStream: +Save the positions to a TQTextStream: .PP .nf .br @@ -117,7 +117,7 @@ Save the positions to a QTextStream: .br .fi .PP -Restore the positions from a QTextStream: +Restore the positions from a TQTextStream: .PP .nf .br @@ -198,11 +198,11 @@ There is no default value; the orientation is specified in the constructor. .PP Get this property's value with orientation(). .SH RELATED FUNCTION DOCUMENTATION -.SH "QTextStream & operator<< ( QTextStream & ts, const QDockArea & dockArea )" +.SH "TQTextStream & operator<< ( TQTextStream & ts, const QDockArea & dockArea )" Writes the layout of the dock windows in dock area \fIdockArea\fR to the text stream \fIts\fR. .PP See also operator>>(). -.SH "QTextStream & operator>> ( QTextStream & ts, QDockArea & dockArea )" +.SH "TQTextStream & operator>> ( TQTextStream & ts, QDockArea & dockArea )" Reads the layout description of the dock windows in dock area \fIdockArea\fR from the text stream \fIts\fR and restores it. The layout description must have been previously written by the operator<<() function. .PP See also operator<<(). diff --git a/doc/man/man3/tqdomnode.3qt b/doc/man/man3/tqdomnode.3qt index 4b9db630..7f68db77 100644 --- a/doc/man/man3/tqdomnode.3qt +++ b/doc/man/man3/tqdomnode.3qt @@ -204,13 +204,13 @@ Inherited by TQDomDocumentType, TQDomDocument, TQDomDocumentFragment, TQDomChara .BI "TQDomComment \fBtoComment\fR ()" .br .ti -1c -.BI "void \fBsave\fR ( QTextStream & str, int indent ) const" +.BI "void \fBsave\fR ( TQTextStream & str, int indent ) const" .br .in -1c .SH RELATED FUNCTION DOCUMENTATION .in +1c .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( QTextStream & str, const TQDomNode & node )" +.BI "TQTextStream & \fBoperator<<\fR ( TQTextStream & str, const TQDomNode & node )" .br .in -1c .SH DESCRIPTION @@ -636,7 +636,7 @@ If \fInewChild\fR is a TQDomDocumentFragment, then \fIoldChild\fR is replaced by Returns a new reference to \fIoldChild\fR on success or a null node an failure. .PP See also insertBefore(), insertAfter(), removeChild(), and appendChild(). -.SH "void TQDomNode::save ( QTextStream & str, int indent ) const" +.SH "void TQDomNode::save ( TQTextStream & str, int indent ) const" Writes the XML representation of the node and all its children to the stream \fIstr\fR. This function uses \fIindent\fR as the amount of space to indent the node. .SH "void TQDomNode::setNodeValue ( const TQString & v )\fC [virtual]\fR" Sets the node's value to \fIv\fR. @@ -703,7 +703,7 @@ Converts a TQDomNode into a TQDomText. If the node is not a text, the returned o .PP See also isText(). .SH RELATED FUNCTION DOCUMENTATION -.SH "QTextStream & operator<< ( QTextStream & str, const TQDomNode & node )" +.SH "TQTextStream & operator<< ( TQTextStream & str, const TQDomNode & node )" Writes the XML representation of the node \fInode\fR and all its children to the stream \fIstr\fR. diff --git a/doc/man/man3/tqdragobject.3qt b/doc/man/man3/tqdragobject.3qt index 5cd6a794..d5453347 100644 --- a/doc/man/man3/tqdragobject.3qt +++ b/doc/man/man3/tqdragobject.3qt @@ -13,7 +13,7 @@ QDragObject \- Encapsulates MIME-based data transfer .PP Inherits TQObject and QMimeSource. .PP -Inherited by QStoredDrag, QTextDrag, TQImageDrag, and QIconDrag. +Inherited by QStoredDrag, TQTextDrag, TQImageDrag, and QIconDrag. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqdropevent.3qt b/doc/man/man3/tqdropevent.3qt index b28c6aa5..86abec60 100644 --- a/doc/man/man3/tqdropevent.3qt +++ b/doc/man/man3/tqdropevent.3qt @@ -93,7 +93,7 @@ The Link and Move actions only makes sense if the data is a reference, for examp .SH "QDropEvent::QDropEvent ( const QPoint & pos, Type typ = Drop )" Constructs a drop event that drops a drop of type \fItyp\fR on point \fIpos\fR. .SH "void QDropEvent::accept ( bool y = TRUE )" -Call this function to indicate whether the event provided data which your widget processed. Set \fIy\fR to TRUE (the default) if your widget could process the data, otherwise set \fIy\fR to FALSE. To get the data, use encodedData(), or preferably, the decode() methods of existing QDragObject subclasses, such as QTextDrag::decode(), or your own subclasses. +Call this function to indicate whether the event provided data which your widget processed. Set \fIy\fR to TRUE (the default) if your widget could process the data, otherwise set \fIy\fR to FALSE. To get the data, use encodedData(), or preferably, the decode() methods of existing QDragObject subclasses, such as TQTextDrag::decode(), or your own subclasses. .PP See also acceptAction(). .PP diff --git a/doc/man/man3/tqeucjpcodec.3qt b/doc/man/man3/tqeucjpcodec.3qt index d1c22f61..cb4fe461 100644 --- a/doc/man/man3/tqeucjpcodec.3qt +++ b/doc/man/man3/tqeucjpcodec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SS "Public Members" .in +1c @@ -33,7 +33,7 @@ Inherits QTextCodec. .SH DESCRIPTION The QEucJpCodec class provides conversion to and from EUC-JP character sets. .PP -More precisely, the QEucJpCodec class subclasses QTextCodec to provide support for EUC-JP, the main legacy encoding for Unix machines in Japan. +More precisely, the QEucJpCodec class subclasses TQTextCodec to provide support for EUC-JP, the main legacy encoding for Unix machines in Japan. .PP The environment variable \fCUNICODEMAP_JP\fR can be used to fine-tune QJisCodec, QSjisCodec and QEucJpCodec. The QJisCodec documentation describes how to use this variable. .PP @@ -58,11 +58,11 @@ Destroys the codec. .SH "int QEucJpCodec::mibEnum () const\fC [virtual]\fR" Returns 18. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "const char * QEucJpCodec::mimeName () const\fC [virtual]\fR" Returns the codec's mime name. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "SEE ALSO" .BR http://doc.trolltech.com/ntqeucjpcodec.html diff --git a/doc/man/man3/tqeuckrcodec.3qt b/doc/man/man3/tqeuckrcodec.3qt index 4bb1b46b..1e0d8962 100644 --- a/doc/man/man3/tqeuckrcodec.3qt +++ b/doc/man/man3/tqeuckrcodec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SS "Public Members" .in +1c @@ -24,7 +24,7 @@ Inherits QTextCodec. .SH DESCRIPTION The QEucKrCodec class provides conversion to and from EUC-KR character sets. .PP -The QEucKrCodec class subclasses QTextCodec to provide support for EUC-KR, the main legacy encoding for UNIX machines in Korea. +The QEucKrCodec class subclasses TQTextCodec to provide support for EUC-KR, the main legacy encoding for UNIX machines in Korea. .PP It was largely written by Mizi Research Inc. Here is the copyright statement for the code as it was at the point of contribution. Trolltech's subsequent modifications are covered by the usual copyright for Qt. .PP @@ -43,7 +43,7 @@ See also Internationalization with Qt. .SH "const char * QEucKrCodec::mimeName () const\fC [virtual]\fR" Returns the codec's mime name. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "SEE ALSO" .BR http://doc.trolltech.com/ntqeuckrcodec.html diff --git a/doc/man/man3/tqfile.3qt b/doc/man/man3/tqfile.3qt index 228c4a0b..46d8aaf5 100644 --- a/doc/man/man3/tqfile.3qt +++ b/doc/man/man3/tqfile.3qt @@ -123,15 +123,15 @@ Inherits TQIODevice. .SH DESCRIPTION The QFile class is an I/O device that operates on files. .PP -QFile is an I/O device for reading and writing binary and text files. A QFile may be used by itself or more conveniently with a QDataStream or QTextStream. +QFile is an I/O device for reading and writing binary and text files. A QFile may be used by itself or more conveniently with a QDataStream or TQTextStream. .PP The file name is usually passed in the constructor but can be changed with setName(). You can check for a file's existence with exists() and remove a file with remove(). .PP -The file is opened with open(), closed with close() and flushed with flush(). Data is usually read and written using QDataStream or QTextStream, but you can read with readBlock() and readLine() and write with writeBlock(). QFile also supports getch(), ungetch() and putch(). +The file is opened with open(), closed with close() and flushed with flush(). Data is usually read and written using QDataStream or TQTextStream, but you can read with readBlock() and readLine() and write with writeBlock(). QFile also supports getch(), ungetch() and putch(). .PP The size of the file is returned by size(). You can get the current file position or move to a new file position using the at() functions. If you've reached the end of the file, atEnd() returns TRUE. The file handle is returned by handle(). .PP -Here is a code fragment that uses QTextStream to read a text file line by line. It prints each line with a line number. +Here is a code fragment that uses TQTextStream to read a text file line by line. It prints each line with a line number. .PP .nf .br @@ -141,7 +141,7 @@ Here is a code fragment that uses QTextStream to read a text file line by line. .br if ( file.open( IO_ReadOnly ) ) { .br - QTextStream stream( &file ); + TQTextStream stream( &file ); .br TQString line; .br @@ -171,7 +171,7 @@ Writing text is just as easy. The following example shows how to write the data .br if ( file.open( IO_WriteOnly ) ) { .br - QTextStream stream( &file ); + TQTextStream stream( &file ); .br for ( TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) .br @@ -189,7 +189,7 @@ The QDir class manages directories and lists of file names. .PP Qt uses Unicode file names. If you want to do your own I/O on Unix systems you may want to use encodeName() (and decodeName()) to convert the file name into the local encoding. .PP -See also QDataStream, QTextStream, and Input/Output and Networking. +See also QDataStream, TQTextStream, and Input/Output and Networking. .SS "Member Type Documentation" .SH "QFile::DecoderFn" This is used by QFile::setDecodingFunction(). @@ -414,7 +414,7 @@ Reads bytes from the file into the char* \fIp\fR, until end-of-line or \fImaxlen .PP This function is only efficient for buffered files. Avoid readLine() for files that have been opened with the IO_Raw flag. .PP -See also readBlock() and QTextStream::readLine(). +See also readBlock() and TQTextStream::readLine(). .PP Reimplemented from TQIODevice. .SH "TQ_LONG QFile::readLine ( TQString & s, TQ_ULONG maxlen )" @@ -428,7 +428,7 @@ This function is only efficient for buffered files. Avoid using readLine() for f .PP Note that the string is read as plain Latin1 bytes, not Unicode. .PP -See also readBlock() and QTextStream::readLine(). +See also readBlock() and TQTextStream::readLine(). .SH "bool QFile::remove ()" Removes the file specified by the file name currently set. Returns TRUE if successful; otherwise returns FALSE. .PP diff --git a/doc/man/man3/tqfontmetrics.3qt b/doc/man/man3/tqfontmetrics.3qt index 9bcfe9fd..d9f860ab 100644 --- a/doc/man/man3/tqfontmetrics.3qt +++ b/doc/man/man3/tqfontmetrics.3qt @@ -80,10 +80,10 @@ QFontMetrics \- Font metrics information .BI "QRect \fBboundingRect\fR ( TQChar ch ) const" .br .ti -1c -.BI "QRect \fBboundingRect\fR ( int x, int y, int w, int h, int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, QTextParag ** intern = 0 ) const" +.BI "QRect \fBboundingRect\fR ( int x, int y, int w, int h, int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** intern = 0 ) const" .br .ti -1c -.BI "QSize \fBsize\fR ( int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, QTextParag ** intern = 0 ) const" +.BI "QSize \fBsize\fR ( int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** intern = 0 ) const" .br .ti -1c .BI "int \fBunderlinePos\fR () const" @@ -180,7 +180,7 @@ Example: xform/xform.cpp. This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the bounding rectangle that contains the first \fIlen\fR characters of string \fIstr\fR. -.SH "QRect QFontMetrics::boundingRect ( int x, int y, int w, int h, int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, QTextParag ** intern = 0 ) const" +.SH "QRect QFontMetrics::boundingRect ( int x, int y, int w, int h, int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** intern = 0 ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the bounding rectangle of the first \fIlen\fR characters of \fIstr\fR, which is the set of pixels the text would cover if drawn at (0, 0). The drawing, and hence the bounding rectangle, is constrained to the rectangle (\fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR). @@ -331,7 +331,7 @@ See width() for a graphical description of this metric. See also leftBearing(), minRightBearing(), and width(). .PP Example: qfd/fontdisplayer.cpp. -.SH "QSize QFontMetrics::size ( int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, QTextParag ** intern = 0 ) const" +.SH "QSize QFontMetrics::size ( int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** intern = 0 ) const" Returns the size in pixels of the first \fIlen\fR characters of \fIstr\fR. .PP If \fIlen\fR is negative (the default), the entire string is used. diff --git a/doc/man/man3/tqgb18030codec.3qt b/doc/man/man3/tqgb18030codec.3qt index af28f6a0..cbf2e29b 100644 --- a/doc/man/man3/tqgb18030codec.3qt +++ b/doc/man/man3/tqgb18030codec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP Inherited by QGbkCodec and QGb2312Codec. .PP diff --git a/doc/man/man3/tqhebrewcodec.3qt b/doc/man/man3/tqhebrewcodec.3qt index 9d584a79..c54ef8fa 100644 --- a/doc/man/man3/tqhebrewcodec.3qt +++ b/doc/man/man3/tqhebrewcodec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SS "Public Members" .in +1c @@ -46,11 +46,11 @@ The algorithm is designed to work on whole paragraphs of text, so processing a l .PP Some encodings (for example Japanese or UTF-8) are multibyte (so one input character is mapped to two output characters). The \fIlenInOut\fR argument specifies the number of QChars that should be converted and is set to the number of characters returned. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "const char * QHebrewCodec::mimeName () const\fC [virtual]\fR" Returns the codec's mime name. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "SEE ALSO" .BR http://doc.trolltech.com/qhebrewcodec.html diff --git a/doc/man/man3/tqiconview.3qt b/doc/man/man3/tqiconview.3qt index a8003b48..73473bfc 100644 --- a/doc/man/man3/tqiconview.3qt +++ b/doc/man/man3/tqiconview.3qt @@ -423,13 +423,13 @@ The simple approach to dragging items out of the icon view is to subclass QIconV .br { .br - return new QTextDrag( currentItem()->text(), this ); + return new TQTextDrag( currentItem()->text(), this ); .br } .br .fi .PP -In this example we create a QTextDrag object, (derived from QDragObject), containing the item's label and return it as the drag object. We could just as easily have created a TQImageDrag from the item's pixmap and returned that instead. +In this example we create a TQTextDrag object, (derived from QDragObject), containing the item's label and return it as the drag object. We could just as easily have created a TQImageDrag from the item's pixmap and returned that instead. .PP QIconViews and their QIconViewItems can also be the targets of drag and drops. To make the QIconView itself able to accept drops connect to the dropped() signal. When a drop occurs this signal will be emitted with a QDragEvent and a TQValueList of QIconDragItems. To make a QIconViewItem into a drop target subclass QIconViewItem and reimplement QIconViewItem::acceptDrop() and QIconViewItem::dropped(). .PP @@ -454,7 +454,7 @@ QIconViews and their QIconViewItems can also be the targets of drag and drops. T .br TQString label; .br - if ( QTextDrag::decode( evt, label ) ) + if ( TQTextDrag::decode( evt, label ) ) .br setText( label ); .br diff --git a/doc/man/man3/tqiodevice.3qt b/doc/man/man3/tqiodevice.3qt index 3405e292..3bf3f353 100644 --- a/doc/man/man3/tqiodevice.3qt +++ b/doc/man/man3/tqiodevice.3qt @@ -152,7 +152,7 @@ The TQIODevice class is the base class of I/O devices. .PP An I/O device represents a medium that one can read bytes from and/or write bytes to. The TQIODevice class is the abstract superclass of all such devices; classes such as QFile, QBuffer and QSocket inherit TQIODevice and implement virtual functions such as write() appropriately. .PP -Although applications sometimes use TQIODevice directly, it is usually better to use QTextStream and QDataStream, which provide stream operations on any TQIODevice subclass. QTextStream provides text-oriented stream functionality (for human-readable ASCII files, for example), whereas QDataStream deals with binary data in a totally platform-independent manner. +Although applications sometimes use TQIODevice directly, it is usually better to use TQTextStream and QDataStream, which provide stream operations on any TQIODevice subclass. TQTextStream provides text-oriented stream functionality (for human-readable ASCII files, for example), whereas QDataStream deals with binary data in a totally platform-independent manner. .PP The public member functions in TQIODevice roughly fall into two groups: the action functions and the state access functions. The most important action functions are: .IP @@ -270,7 +270,7 @@ TQIODevice provides numerous pure virtual functions that you need to implement w .PP The three non-pure virtual functions need not be reimplemented for sequential devices. .PP -See also QDataStream, QTextStream, and Input/Output and Networking. +See also QDataStream, TQTextStream, and Input/Output and Networking. .SS "Member Type Documentation" .SH "TQIODevice::Offset" The offset within the device. @@ -447,7 +447,7 @@ Returns the number of bytes read including the terminating '\0', or -1 if an .PP This virtual function can be reimplemented much more efficiently by the most subclasses. .PP -See also readBlock() and QTextStream::readLine(). +See also readBlock() and TQTextStream::readLine(). .PP Reimplemented in QFile. .SH "bool TQIODevice::reset ()" diff --git a/doc/man/man3/tqjiscodec.3qt b/doc/man/man3/tqjiscodec.3qt index 000b1349..e592ce5a 100644 --- a/doc/man/man3/tqjiscodec.3qt +++ b/doc/man/man3/tqjiscodec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SS "Public Members" .in +1c @@ -24,7 +24,7 @@ Inherits QTextCodec. .SH DESCRIPTION The QJisCodec class provides conversion to and from JIS character sets. .PP -More precisely, the QJisCodec class subclasses QTextCodec to provide support for JIS X 0201 Latin, JIS X 0201 Kana, JIS X 0208 and JIS X 0212. +More precisely, the QJisCodec class subclasses TQTextCodec to provide support for JIS X 0201 Latin, JIS X 0201 Kana, JIS X 0208 and JIS X 0212. .PP The environment variable UNICODEMAP_JP can be used to fine-tune QJisCodec, QSjisCodec and QEucJpCodec. The mapping names are as for the Japanese XML working group's XML Japanese Profile, because it names and explains all the widely used mappings. Here are brief descriptions, written by Serika Kurusugawa: .IP @@ -68,7 +68,7 @@ See also Internationalization with Qt. .SH "const char * QJisCodec::mimeName () const\fC [virtual]\fR" Returns the codec's mime name. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "SEE ALSO" .BR http://doc.trolltech.com/ntqjiscodec.html diff --git a/doc/man/man3/tqlabel.3qt b/doc/man/man3/tqlabel.3qt index 621dc7e1..360d5743 100644 --- a/doc/man/man3/tqlabel.3qt +++ b/doc/man/man3/tqlabel.3qt @@ -180,7 +180,7 @@ In this example, keyboard focus is transferred to the label's buddy (the QLineEd .ce 1 .B "[Image Omitted]" .PP -See also QLineEdit, QTextEdit, QPixmap, QMovie, GUI Design Handbook: Label, Basic Widgets, and Text Related Classes. +See also QLineEdit, TQTextEdit, QPixmap, QMovie, GUI Design Handbook: Label, Basic Widgets, and Text Related Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "QLabel::QLabel ( TQWidget * parent, const char * name = 0, WFlags f = 0 )" Constructs an empty label. @@ -393,7 +393,7 @@ If the text is interpreted as a plain text and a buddy has been set, the buddy a .PP The label resizes itself if auto-resizing is enabled. .PP -Note that Qlabel is well-suited to display small rich text documents, i.e. those small documents that get their document specific settings (font, text color, link color) from the label's palette and font properties. For large documents, use QTextEdit in read-only mode instead. QTextEdit will flicker less on resize and can also provide a scrollbar when necessary. +Note that Qlabel is well-suited to display small rich text documents, i.e. those small documents that get their document specific settings (font, text color, link color) from the label's palette and font properties. For large documents, use TQTextEdit in read-only mode instead. TQTextEdit will flicker less on resize and can also provide a scrollbar when necessary. .PP See also textFormat, setBuddy(), and alignment. .PP diff --git a/doc/man/man3/tqlineedit.3qt b/doc/man/man3/tqlineedit.3qt index 097adb23..79c09d9f 100644 --- a/doc/man/man3/tqlineedit.3qt +++ b/doc/man/man3/tqlineedit.3qt @@ -286,7 +286,7 @@ By changing the echoMode() of a line edit, it can also be used as a "write-only" .PP The length of the text can be constrained to maxLength(). The text can be arbitrarily constrained using a validator() or an inputMask(), or both. .PP -A related class is QTextEdit which allows multi-line, rich-text editing. +A related class is TQTextEdit which allows multi-line, rich-text editing. .PP You can change the text with setText() or insert(). The text is retrieved with text(); the displayed text (which may be different, see EchoMode) is retrieved with displayText(). Text can be selected with setSelection() or selectAll(), and the selection can be cut(), copy()ied and paste()d. The text can be aligned with setAlignment(). .PP @@ -310,7 +310,7 @@ Any other key sequence that represents a valid character, will cause the charact .ce 1 .B "[Image Omitted]" .PP -See also QTextEdit, QLabel, QComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets. +See also TQTextEdit, QLabel, QComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets. .SS "Member Type Documentation" .SH "QLineEdit::EchoMode" This enum type describes how a line edit should display its contents. diff --git a/doc/man/man3/tqmacmime.3qt b/doc/man/man3/tqmacmime.3qt index c2ca8db2..fd0740e2 100644 --- a/doc/man/man3/tqmacmime.3qt +++ b/doc/man/man3/tqmacmime.3qt @@ -65,9 +65,9 @@ By instantiating subclasses of QMacMime that provide conversions between Mac fla .PP Qt has predefined support for the following Mac flavors: .TP -kScrapFlavorTypeUnicode - converted to "text/plain;charset=ISO-10646-UCS-2" and supported by QTextDrag. +kScrapFlavorTypeUnicode - converted to "text/plain;charset=ISO-10646-UCS-2" and supported by TQTextDrag. .TP -kScrapFlavorTypeText - converted to "text/plain;charset=system" or "text/plain" and supported by QTextDrag. +kScrapFlavorTypeText - converted to "text/plain;charset=system" or "text/plain" and supported by TQTextDrag. .TP kScrapFlavorTypePicture - converted to "image/format", where format is a TQt image format, and supported by TQImageDrag. .TP diff --git a/doc/man/man3/tqmacstyle.3qt b/doc/man/man3/tqmacstyle.3qt index 700edcf1..5bd3da5f 100644 --- a/doc/man/man3/tqmacstyle.3qt +++ b/doc/man/man3/tqmacstyle.3qt @@ -73,7 +73,7 @@ This type is used to signify a widget's focus rectangle policy. .TP \fCQMacStyle::FocusDisabled\fR - never show a focus rectangle for the widget. .TP -\fCQMacStyle::FocusDefault\fR - show a focus rectangle when the widget has focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit, QListBox, QListView, editable QTextEdit, or one of their subclasses. +\fCQMacStyle::FocusDefault\fR - show a focus rectangle when the widget has focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit, QListBox, QListView, editable TQTextEdit, or one of their subclasses. .SH "QMacStyle::WidgetSizePolicy" .TP \fCQMacStyle::SizeSmall\fR diff --git a/doc/man/man3/tqmainwindow.3qt b/doc/man/man3/tqmainwindow.3qt index 244760e1..0d7f189e 100644 --- a/doc/man/man3/tqmainwindow.3qt +++ b/doc/man/man3/tqmainwindow.3qt @@ -238,10 +238,10 @@ Inherits TQWidget. .SH RELATED FUNCTION DOCUMENTATION .in +1c .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( QTextStream & ts, const QMainWindow & mainWindow )" +.BI "TQTextStream & \fBoperator<<\fR ( TQTextStream & ts, const QMainWindow & mainWindow )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( QTextStream & ts, QMainWindow & mainWindow )" +.BI "TQTextStream & \fBoperator>>\fR ( TQTextStream & ts, QMainWindow & mainWindow )" .br .in -1c .SH DESCRIPTION @@ -253,7 +253,7 @@ Main windows are most often used to provide menus, toolbars and a status bar aro .br QMainWindow *mw = new QMainWindow; .br - QTextEdit *edit = new QTextEdit( mw, "editor" ); + TQTextEdit *edit = new TQTextEdit( mw, "editor" ); .br edit->setFocus(); .br @@ -312,7 +312,7 @@ This extract shows the creation of a toolbar with one toolbar button. QMainWindo .PP .nf .br - e = new QTextEdit( this, "editor" ); + e = new TQTextEdit( this, "editor" ); .br e->setFocus(); .br @@ -422,7 +422,7 @@ To save the layout and positions of all the dock windows do this: .br if ( file.open( IO_WriteOnly ) ) { .br - QTextStream stream( &file ); + TQTextStream stream( &file ); .br stream << *mainWindow; .br @@ -440,7 +440,7 @@ To restore the dock window positions and sizes (normally when the application is .br if ( file.open( IO_ReadOnly ) ) { .br - QTextStream stream( &file ); + TQTextStream stream( &file ); .br stream >> *mainWindow; .br @@ -806,13 +806,13 @@ See also QToolButton::usesTextLabel. .PP Set this property's value with setUsesTextLabel() and get this property's value with usesTextLabel(). .SH RELATED FUNCTION DOCUMENTATION -.SH "QTextStream & operator<< ( QTextStream & ts, const QMainWindow & mainWindow )" +.SH "TQTextStream & operator<< ( TQTextStream & ts, const QMainWindow & mainWindow )" Writes the layout (sizes and positions) of the dock windows in the dock areas of the QMainWindow \fImainWindow\fR, including Minimized and TornOff dock windows, to the text stream \fIts\fR. .PP This can be used, for example, in conjunction with QSettings to save the user's layout when the \\mainWindow receives a closeEvent. .PP See also operator>>() and closeEvent(). -.SH "QTextStream & operator>> ( QTextStream & ts, QMainWindow & mainWindow )" +.SH "TQTextStream & operator>> ( TQTextStream & ts, QMainWindow & mainWindow )" Reads the layout (sizes and positions) of the dock windows in the dock areas of the QMainWindow \fImainWindow\fR from the text stream, \fIts\fR, including Minimized and TornOff dock windows. Restores the dock windows and dock areas to these sizes and positions. The layout information must be in the format produced by operator<<(). .PP This can be used, for example, in conjunction with QSettings to restore the user's layout. diff --git a/doc/man/man3/tqmimesource.3qt b/doc/man/man3/tqmimesource.3qt index 494ff539..8263cdb6 100644 --- a/doc/man/man3/tqmimesource.3qt +++ b/doc/man/man3/tqmimesource.3qt @@ -60,7 +60,7 @@ Reimplemented in QDropEvent. .SH "bool QMimeSource::provides ( const char * mimeType ) const\fC [virtual]\fR" Returns TRUE if the object can provide the data in format \fImimeType\fR; otherwise returns FALSE. .PP -If you inherit from QMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such as QTextDrag::canDecode() and TQImageDrag::canDecode(). +If you inherit from QMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such as TQTextDrag::canDecode() and TQImageDrag::canDecode(). .PP Example: iconview/simple_dd/main.cpp. .PP diff --git a/doc/man/man3/tqmimesourcefactory.3qt b/doc/man/man3/tqmimesourcefactory.3qt index eb6b2a30..1ca7c8d7 100644 --- a/doc/man/man3/tqmimesourcefactory.3qt +++ b/doc/man/man3/tqmimesourcefactory.3qt @@ -78,7 +78,7 @@ A QMimeSourceFactory provides an abstract interface to a collection of informati .PP The base QMimeSourceFactory can be used in two ways: as an abstraction of a collection of files or as specifically stored data. For it to access files, call setFilePath() before accessing data. For stored data, call setData() for each item (there are also convenience functions, e.g. setText(), setImage() and setPixmap(), that simply call setData() with appropriate parameters). .PP -The rich text widgets, QTextEdit and QTextBrowser, use QMimeSourceFactory to resolve references such as images or links within rich text documents. They either access the default factory (see defaultFactory()) or their own (see QTextEdit::setMimeSourceFactory()). Other classes that are capable of displaying rich text (such as QLabel, QWhatsThis or QMessageBox) always use the default factory. +The rich text widgets, TQTextEdit and TQTextBrowser, use QMimeSourceFactory to resolve references such as images or links within rich text documents. They either access the default factory (see defaultFactory()) or their own (see TQTextEdit::setMimeSourceFactory()). Other classes that are capable of displaying rich text (such as QLabel, QWhatsThis or QMessageBox) always use the default factory. .PP A factory can also be used as a container to store data associated with a name. This technique is useful whenever rich text contains images that are stored in the program itself, not loaded from the hard disk. Your program may, for example, define some image data as: .PP @@ -166,7 +166,7 @@ This is an overloaded member function, provided for convenience. It behaves esse .PP A convenience function. See data(const TQString& abs_name). The file name is given in \fIabs_or_rel_name\fR and the path is in \fIcontext\fR. .SH "QMimeSourceFactory * QMimeSourceFactory::defaultFactory ()\fC [static]\fR" -Returns the application-wide default mime source factory. This factory is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and QMessageBox to resolve named references within rich text documents. It serves also as the initial factory for the more complex render widgets, QTextEdit and QTextBrowser. +Returns the application-wide default mime source factory. This factory is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and QMessageBox to resolve named references within rich text documents. It serves also as the initial factory for the more complex render widgets, TQTextEdit and TQTextBrowser. .PP See also setDefaultFactory(). .PP @@ -203,7 +203,7 @@ Sets \fIpixmap\fR to be the data item associated with the absolute name \fIabs_n .SH "void QMimeSourceFactory::setText ( const TQString & abs_name, const TQString & text )\fC [virtual]\fR" Sets \fItext\fR to be the data item associated with the absolute name \fIabs_name\fR. .PP -Equivalent to setData(abs_name, new QTextDrag(text)). +Equivalent to setData(abs_name, new TQTextDrag(text)). .SH "QMimeSourceFactory * QMimeSourceFactory::takeDefaultFactory ()\fC [static]\fR" Sets the defaultFactory() to 0 and returns the previous one. diff --git a/doc/man/man3/tqnpstream.3qt b/doc/man/man3/tqnpstream.3qt index c030186a..d948389c 100644 --- a/doc/man/man3/tqnpstream.3qt +++ b/doc/man/man3/tqnpstream.3qt @@ -57,7 +57,7 @@ This class is defined in the \fBQt Netscape Extension\fR, which can be found in .PP The QNPStream class provides a stream of data provided to a QNPInstance by the browser. .PP -Note that this is neither a QTextStream nor a QDataStream. +Note that this is neither a TQTextStream nor a QDataStream. .PP See also QNPInstance::write() and QNPInstance::newStreamCreated(). .SH MEMBER FUNCTION DOCUMENTATION diff --git a/doc/man/man3/tqobject.3qt b/doc/man/man3/tqobject.3qt index b741deaf..c96785f3 100644 --- a/doc/man/man3/tqobject.3qt +++ b/doc/man/man3/tqobject.3qt @@ -525,7 +525,7 @@ Example: .br private: .br - QTextEdit *textEdit; + TQTextEdit *textEdit; .br }; .br @@ -536,7 +536,7 @@ Example: .br { .br - textEdit = new QTextEdit( this ); + textEdit = new TQTextEdit( this ); .br setCentralWidget( textEdit ); .br diff --git a/doc/man/man3/tqpainter.3qt b/doc/man/man3/tqpainter.3qt index 7072d00f..6b8005fb 100644 --- a/doc/man/man3/tqpainter.3qt +++ b/doc/man/man3/tqpainter.3qt @@ -384,16 +384,16 @@ Inherited by QDirectPainter. .BI "void \fBdrawText\fR ( const QPoint & p, const TQString &, int pos, int len, TextDirection dir = Auto )" .br .ti -1c -.BI "void \fBdrawText\fR ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, QRect * br = 0, QTextParag ** internal = 0 )" +.BI "void \fBdrawText\fR ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, QRect * br = 0, TQTextParag ** internal = 0 )" .br .ti -1c -.BI "void \fBdrawText\fR ( const QRect & r, int tf, const TQString & str, int len = -1, QRect * brect = 0, QTextParag ** internal = 0 )" +.BI "void \fBdrawText\fR ( const QRect & r, int tf, const TQString & str, int len = -1, QRect * brect = 0, TQTextParag ** internal = 0 )" .br .ti -1c -.BI "QRect \fBboundingRect\fR ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, QTextParag ** intern = 0 )" +.BI "QRect \fBboundingRect\fR ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, TQTextParag ** intern = 0 )" .br .ti -1c -.BI "QRect \fBboundingRect\fR ( const QRect & r, int flags, const TQString & str, int len = -1, QTextParag ** internal = 0 )" +.BI "QRect \fBboundingRect\fR ( const QRect & r, int flags, const TQString & str, int len = -1, TQTextParag ** internal = 0 )" .br .ti -1c .BI "int \fBtabStops\fR () const" @@ -694,7 +694,7 @@ Example: .fi .PP See also end(). -.SH "QRect QPainter::boundingRect ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, QTextParag ** intern = 0 )" +.SH "QRect QPainter::boundingRect ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, TQTextParag ** intern = 0 )" Returns the bounding rectangle of the aligned text that would be printed with the corresponding drawText() function using the first \fIlen\fR characters of the string if \fIlen\fR is > -1, or the whole of the string if \fIlen\fR is -1. The drawing, and hence the bounding rectangle, is constrained to the rectangle that begins at point \fI(x, y)\fR with width \fIw\fR and hight \fIh\fR, or to the rectangle required to draw the text, whichever is the larger. .PP The \fIflags\fR argument is the bitwise OR of the following flags:

    .nf @@ -711,7 +711,7 @@ If several of the horizontal or several of the vertical alignment flags are set, The \fIintern\fR parameter should not be used. .PP See also TQt::TextFlags. -.SH "QRect QPainter::boundingRect ( const QRect & r, int flags, const TQString & str, int len = -1, QTextParag ** internal = 0 )" +.SH "QRect QPainter::boundingRect ( const QRect & r, int flags, const TQString & str, int len = -1, TQTextParag ** internal = 0 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the bounding rectangle of the aligned text that would be printed with the corresponding drawText() function using the first \fIlen\fR characters from \fIstr\fR if \fIlen\fR is > -1, or the whole of \fIstr\fR if \fIlen\fR is -1. The drawing, and hence the bounding rectangle, is constrained to the rectangle \fIr\fR, or to the rectangle required to draw the text, whichever is the larger. @@ -994,11 +994,11 @@ See also QPainter::TextDirection. This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Draws the text from position \fIpos\fR, at point \fI(x, y)\fR. If \fIlen\fR is -1 the entire string is drawn, otherwise just the first \fIlen\fR characters. The text's direction is specified by \fIdir\fR. -.SH "void QPainter::drawText ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, QRect * br = 0, QTextParag ** internal = 0 )" +.SH "void QPainter::drawText ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, QRect * br = 0, TQTextParag ** internal = 0 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Draws the given text within the rectangle starting at \fIx\fR, \fIy\fR, with width \fIw\fR and height \fIh\fR. If \fIlen\fR is -1 (the default) all the text is drawn, otherwise the first \fIlen\fR characters are drawn. The text's flags that are given in the \fIflags\fR parameter are TQt::AlignmentFlags and TQt::TextFlags OR'd together. \fIbr\fR (if not null) is set to the actual bounding rectangle of the output. The \fIinternal\fR parameter is for internal use only. -.SH "void QPainter::drawText ( const QRect & r, int tf, const TQString & str, int len = -1, QRect * brect = 0, QTextParag ** internal = 0 )" +.SH "void QPainter::drawText ( const QRect & r, int tf, const TQString & str, int len = -1, QRect * brect = 0, TQTextParag ** internal = 0 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Draws at most \fIlen\fR characters from \fIstr\fR in the rectangle \fIr\fR. diff --git a/doc/man/man3/tqprocess.3qt b/doc/man/man3/tqprocess.3qt index d6094bae..1a02d2f9 100644 --- a/doc/man/man3/tqprocess.3qt +++ b/doc/man/man3/tqprocess.3qt @@ -395,13 +395,13 @@ Use of this function's return value is likely to be non-portable. .SH "TQString QProcess::readLineStderr ()\fC [virtual]\fR" Reads a line of text from standard error, excluding any trailing newline or carriage return characters and returns it. Returns TQString::null if canReadLineStderr() returns FALSE. .PP -By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with QTextCodec::setCodecForCStrings(). +By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with TQTextCodec::setCodecForCStrings(). .PP See also canReadLineStderr(), readyReadStderr(), readStderr(), and readLineStdout(). .SH "TQString QProcess::readLineStdout ()\fC [virtual]\fR" Reads a line of text from standard output, excluding any trailing newline or carriage return characters, and returns it. Returns TQString::null if canReadLineStdout() returns FALSE. .PP -By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with QTextCodec::setCodecForCStrings(). +By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with TQTextCodec::setCodecForCStrings(). .PP See also canReadLineStdout(), readyReadStdout(), readStdout(), and readLineStderr(). .SH "QByteArray QProcess::readStderr ()\fC [virtual]\fR" diff --git a/doc/man/man3/tqscrollview.3qt b/doc/man/man3/tqscrollview.3qt index baa98574..aee662c8 100644 --- a/doc/man/man3/tqscrollview.3qt +++ b/doc/man/man3/tqscrollview.3qt @@ -13,7 +13,7 @@ QScrollView \- Scrolling area with on-demand scroll bars .PP Inherits QFrame. .PP -Inherited by TQCanvasView, QTable, QGridView, QIconView, QListBox, QListView, and QTextEdit. +Inherited by TQCanvasView, QTable, QGridView, QIconView, QListBox, QListView, and TQTextEdit. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqsimplerichtext.3qt b/doc/man/man3/tqsimplerichtext.3qt index f08bf379..834f3c16 100644 --- a/doc/man/man3/tqsimplerichtext.3qt +++ b/doc/man/man3/tqsimplerichtext.3qt @@ -68,7 +68,7 @@ Once created, the rich text object can be queried for its width(), height(), and .PP Once constructed from a string the contents cannot be changed, only resized. If the contents change, just throw the rich text object away and make a new one with the new contents. .PP -For large documents use QTextEdit or QTextBrowser. For very small items of rich text you can use a QLabel. +For large documents use TQTextEdit or TQTextBrowser. For very small items of rich text you can use a QLabel. .PP If you are using QSimpleRichText to print in high resolution you should call setWidth(QPainter, int) so that the content will be laid out properly on the page. .PP diff --git a/doc/man/man3/tqsjiscodec.3qt b/doc/man/man3/tqsjiscodec.3qt index e04b3654..22ae99d3 100644 --- a/doc/man/man3/tqsjiscodec.3qt +++ b/doc/man/man3/tqsjiscodec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include \fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SS "Public Members" .in +1c @@ -30,7 +30,7 @@ Inherits QTextCodec. .SH DESCRIPTION The QSjisCodec class provides conversion to and from Shift-JIS. .PP -More precisely, the QSjisCodec class subclasses QTextCodec to provide support for Shift-JIS, an encoding of JIS X 0201 Latin, JIS X 0201 Kana or JIS X 0208. +More precisely, the QSjisCodec class subclasses TQTextCodec to provide support for Shift-JIS, an encoding of JIS X 0201 Latin, JIS X 0201 Kana or JIS X 0208. .PP The environment variable \fCUNICODEMAP_JP\fR can be used to fine-tune QJisCodec, QSjisCodec and QEucJpCodec. The QJisCodec documentation describes how to use this variable. .PP @@ -55,7 +55,7 @@ Destroys the Shift-JIS codec. .SH "const char * QSjisCodec::mimeName () const\fC [virtual]\fR" Returns the codec's mime name. .PP -Reimplemented from QTextCodec. +Reimplemented from TQTextCodec. .SH "SEE ALSO" .BR http://doc.trolltech.com/ntqsjiscodec.html diff --git a/doc/man/man3/tqsplitter.3qt b/doc/man/man3/tqsplitter.3qt index 59ab39e3..0c6021a8 100644 --- a/doc/man/man3/tqsplitter.3qt +++ b/doc/man/man3/tqsplitter.3qt @@ -115,10 +115,10 @@ Inherits QFrame. .SH RELATED FUNCTION DOCUMENTATION .in +1c .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( QTextStream & ts, const QSplitter & splitter )" +.BI "TQTextStream & \fBoperator<<\fR ( TQTextStream & ts, const QSplitter & splitter )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( QTextStream & ts, QSplitter & splitter )" +.BI "TQTextStream & \fBoperator>>\fR ( TQTextStream & ts, QSplitter & splitter )" .br .in -1c .SH DESCRIPTION @@ -126,7 +126,7 @@ The QSplitter class implements a splitter widget. .PP A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled by a single splitter. .PP -To show a QListBox, a QListView and a QTextEdit side by side: +To show a QListBox, a QListView and a TQTextEdit side by side: .PP .nf .br @@ -136,7 +136,7 @@ To show a QListBox, a QListView and a QTextEdit side by side: .br QListView *lv = new QListView( split ); .br - QTextEdit *ed = new QTextEdit( split ); + TQTextEdit *ed = new TQTextEdit( split ); .br .fi .PP @@ -297,11 +297,11 @@ By default the orientation is horizontal (the widgets are side by side). The pos .PP Set this property's value with setOrientation() and get this property's value with orientation(). .SH RELATED FUNCTION DOCUMENTATION -.SH "QTextStream & operator<< ( QTextStream & ts, const QSplitter & splitter )" +.SH "TQTextStream & operator<< ( TQTextStream & ts, const QSplitter & splitter )" Writes the sizes and the hidden state of the widgets in the splitter \fIsplitter\fR to the text stream \fIts\fR. .PP See also operator>>(), sizes(), and TQWidget::hidden. -.SH "QTextStream & operator>> ( QTextStream & ts, QSplitter & splitter )" +.SH "TQTextStream & operator>> ( TQTextStream & ts, QSplitter & splitter )" Reads the sizes and the hidden state of the widgets in the splitter \fIsplitter\fR from the text stream \fIts\fR. The sizes must have been previously written by the operator<<() function. .PP See also operator<<(), setSizes(), and TQWidget::hide(). diff --git a/doc/man/man3/tqsqlpropertymap.3qt b/doc/man/man3/tqsqlpropertymap.3qt index 8dd222df..c5bc51d7 100644 --- a/doc/man/man3/tqsqlpropertymap.3qt +++ b/doc/man/man3/tqsqlpropertymap.3qt @@ -123,7 +123,7 @@ Constructs a TQSqlPropertyMap. .PP The default property mappings used by TQt widgets are:
    .nf .TS -l - l. Widgets Property QCheckBox, QRadioButton checked QComboBox, QListBox currentItem QDateEdit date QDateTimeEdit dateTime QTextBrowser source QButton, QDial, QLabel, QLineEdit, QMultiLineEdit, QPushButton, QTextEdit, text QTimeEdit time QLCDNumber, QScrollBar QSlider, QSpinBox +l - l. Widgets Property QCheckBox, QRadioButton checked QComboBox, QListBox currentItem QDateEdit date QDateTimeEdit dateTime TQTextBrowser source QButton, QDial, QLabel, QLineEdit, QMultiLineEdit, QPushButton, TQTextEdit, text QTimeEdit time QLCDNumber, QScrollBar QSlider, QSpinBox .TE .fi
    diff --git a/doc/man/man3/tqstring.3qt b/doc/man/man3/tqstring.3qt index 596dc409..59383a65 100644 --- a/doc/man/man3/tqstring.3qt +++ b/doc/man/man3/tqstring.3qt @@ -692,7 +692,7 @@ If only \fIunicode\fR is 0, the string is empty but has \fIlength\fR characters .PP See also isNull() and setLength(). .SH "TQString::TQString ( const char * str )" -Constructs a string that is a deep copy of \fIstr\fR, interpreted as a classic C string. The encoding is assumed to be Latin-1, unless you change it using QTextCodec::setCodecForCStrings(). +Constructs a string that is a deep copy of \fIstr\fR, interpreted as a classic C string. The encoding is assumed to be Latin-1, unless you change it using TQTextCodec::setCodecForCStrings(). .PP If \fIstr\fR is 0, then a null string is created. .PP @@ -897,7 +897,7 @@ This is the same as calling str.arg(\fIa1\fR).arg(\fIa2\fR).arg(\fIa3\fR).arg(\f .SH "const char * TQString::ascii () const" Returns an 8-bit ASCII representation of the string. .PP -If a codec has been set using QTextCodec::codecForCStrings(), it is used to convert Unicode to 8-bit char. Otherwise, this function does the same as latin1(). +If a codec has been set using TQTextCodec::codecForCStrings(), it is used to convert Unicode to 8-bit char. Otherwise, this function does the same as latin1(). .PP See also fromAscii(), latin1(), utf8(), and local8Bit(). .PP @@ -1156,7 +1156,7 @@ See also find(). .SH "TQString TQString::fromAscii ( const char * ascii, int len = -1 )\fC [static]\fR" Returns the Unicode string decoded from the first \fIlen\fR bytes of \fIascii\fR, ignoring the rest of \fIascii\fR. If \fIlen\fR is -1 then the length of \fIascii\fR is used. If \fIlen\fR is bigger than the length of \fIascii\fR then it will use the length of \fIascii\fR. .PP -If a codec has been set using QTextCodec::codecForCStrings(), it is used to convert the string from 8-bit characters to Unicode. Otherwise, this function does the same as fromLatin1(). +If a codec has been set using TQTextCodec::codecForCStrings(), it is used to convert the string from 8-bit characters to Unicode. Otherwise, this function does the same as fromLatin1(). .PP This is the same as the TQString(const char*) constructor, but you can make that constructor invisible if you compile with the define \fCTQT_NO_CAST_ASCII\fR, in which case you can explicitly create a TQString from 8-bit ASCII text using this function. .PP @@ -1187,7 +1187,7 @@ Returns the Unicode string decoded from the first \fIlen\fR bytes of \fIlocal8Bi .PP \fIlocal8Bit\fR is assumed to be encoded in a locale-specific format. .PP -See QTextCodec for more diverse coding/decoding of Unicode strings. +See TQTextCodec for more diverse coding/decoding of Unicode strings. .SH "TQString TQString::fromUcs2 ( const unsigned short * str )\fC [static]\fR" Constructs a string that is a deep copy of \fIstr\fR, interpreted as a UCS2 encoded, zero terminated, Unicode string. .PP @@ -1205,7 +1205,7 @@ Returns the Unicode string decoded from the first \fIlen\fR bytes of \fIutf8\fR, .br .fi .PP -See QTextCodec for more diverse coding/decoding of Unicode strings. +See TQTextCodec for more diverse coding/decoding of Unicode strings. .PP Example: fonts/simple-qfont-demo/viewer.cpp. .SH "TQString & TQString::insert ( uint index, const TQString & s )" @@ -1291,7 +1291,7 @@ See also isEmpty() and length(). Examples: .)l i18n/main.cpp, network/ftpclient/ftpmainwindow.ui.h, and qdir/qdir.cpp. .SH "const char * TQString::latin1 () const" -Returns a Latin-1 representation of the string. The returned value is undefined if the string contains non-Latin-1 characters. If you want to convert strings into formats other than Unicode, see the QTextCodec classes. +Returns a Latin-1 representation of the string. The returned value is undefined if the string contains non-Latin-1 characters. If you want to convert strings into formats other than Unicode, see the TQTextCodec classes. .PP This function is mainly useful for boot-strapping legacy code to use Unicode. .PP @@ -1343,9 +1343,9 @@ See also isNull() and isEmpty(). Examples: .)l dirview/dirview.cpp, fileiconview/qfileiconview.cpp, network/networkprotocol/nntp.cpp, rot13/rot13.cpp, and themes/themes.cpp. .SH "QCString TQString::local8Bit () const" -Returns the string encoded in a locale-specific format. On X11, this is the QTextCodec::codecForLocale(). On Windows, it is a system-defined encoding. On Mac OS X, this always uses UTF-8 as the encoding. +Returns the string encoded in a locale-specific format. On X11, this is the TQTextCodec::codecForLocale(). On Windows, it is a system-defined encoding. On Mac OS X, this always uses UTF-8 as the encoding. .PP -See QTextCodec for more diverse coding/decoding of Unicode strings. +See TQTextCodec for more diverse coding/decoding of Unicode strings. .PP See also fromLocal8Bit(), ascii(), latin1(), and utf8(). .SH "int TQString::localeAwareCompare ( const TQString & s1, const TQString & s2 )\fC [static]\fR" @@ -1353,7 +1353,7 @@ Compares \fIs1\fR with \fIs2\fR and returns an integer less than, equal to, or g .PP The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user. .PP -See also TQString::compare() and QTextCodec::locale(). +See also TQString::compare() and TQTextCodec::locale(). .SH "int TQString::localeAwareCompare ( const TQString & s ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP @@ -2058,7 +2058,7 @@ See also stripWhiteSpace(). .SH "TQString & TQString::sprintf ( const char * cformat, ... )" Safely builds a formatted string from the format string \fIcformat\fR and an arbitrary list of arguments. The format string supports all the escape sequences of printf() in the standard C library. .PP -The %s escape sequence expects a utf8() encoded string. The format string \fIcformat\fR is expected to be in latin1. If you need a Unicode format string, use arg() instead. For typesafe string building, with full Unicode support, you can use QTextOStream like this: +The %s escape sequence expects a utf8() encoded string. The format string \fIcformat\fR is expected to be in latin1. If you need a Unicode format string, use arg() instead. For typesafe string building, with full Unicode support, you can use TQTextOStream like this: .PP .nf .br @@ -2068,7 +2068,7 @@ The %s escape sequence expects a utf8() encoded string. The format string \fIcfo .br int x = ...; .br - QTextOStream( &str ) << s << " : " << x; + TQTextOStream( &str ) << s << " : " << x; .br .fi .PP @@ -2394,7 +2394,7 @@ Examples: .SH "QCString TQString::utf8 () const" Returns the string encoded in UTF-8 format. .PP -See QTextCodec for more diverse coding/decoding of Unicode strings. +See TQTextCodec for more diverse coding/decoding of Unicode strings. .PP See also fromUtf8(), ascii(), latin1(), and local8Bit(). .PP diff --git a/doc/man/man3/tqstylesheet.3qt b/doc/man/man3/tqstylesheet.3qt index 19e06943..994e8ddd 100644 --- a/doc/man/man3/tqstylesheet.3qt +++ b/doc/man/man3/tqstylesheet.3qt @@ -28,7 +28,7 @@ Inherits TQObject. .BI "const QStyleSheetItem * \fBitem\fR ( const TQString & name ) const" .br .ti -1c -.BI "virtual QTextCustomItem * \fBtag\fR ( const TQString & name, const TQMap & attr, const TQString & context, const QMimeSourceFactory & factory, bool emptyTag, QTextDocument * doc ) const" +.BI "virtual TQTextCustomItem * \fBtag\fR ( const TQString & name, const TQMap & attr, const TQString & context, const QMimeSourceFactory & factory, bool emptyTag, TQTextDocument * doc ) const" .br .ti -1c .BI "virtual void \fBscaleFont\fR ( QFont & font, int logicalSize ) const" @@ -58,7 +58,7 @@ Inherits TQObject. .SH DESCRIPTION The QStyleSheet class is a collection of styles for rich text rendering and a generator of tags. .PP -By creating QStyleSheetItem objects for a style sheet you build a definition of a set of tags. This definition will be used by the internal rich text rendering system to parse and display text documents to which the style sheet applies. Rich text is normally visualized in a QTextEdit or a QTextBrowser. However, QLabel, QWhatsThis and QMessageBox also support it, and other classes are likely to follow. With QSimpleRichText it is possible to use the rich text renderer for custom widgets as well. +By creating QStyleSheetItem objects for a style sheet you build a definition of a set of tags. This definition will be used by the internal rich text rendering system to parse and display text documents to which the style sheet applies. Rich text is normally visualized in a TQTextEdit or a TQTextBrowser. However, QLabel, QWhatsThis and QMessageBox also support it, and other classes are likely to follow. With QSimpleRichText it is possible to use the rich text renderer for custom widgets as well. .PP The default QStyleSheet object has the following style bindings, sorted by structuring bindings, anchors, character style bindings (i.e. inline styles), special elements such as horizontal lines or images, and other tags. In addition, rich text supports simple HTML tables. .PP @@ -152,7 +152,7 @@ See also escape(). Examples: .)l action/application.cpp, application/application.cpp, and mdi/application.cpp. .SH "QStyleSheet * QStyleSheet::defaultSheet ()\fC [static]\fR" -Returns the application-wide default style sheet. This style sheet is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and QMessageBox to define the rendering style and available tags within rich text documents. It also serves as the initial style sheet for the more complex render widgets, QTextEdit and QTextBrowser. +Returns the application-wide default style sheet. This style sheet is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and QMessageBox to define the rendering style and available tags within rich text documents. It also serves as the initial style sheet for the more complex render widgets, TQTextEdit and TQTextBrowser. .PP See also setDefaultSheet(). .SH "void QStyleSheet::error ( const TQString & msg ) const\fC [virtual]\fR" @@ -187,7 +187,7 @@ See also QStyleSheetItem::logicalFontSize(), QStyleSheetItem::logicalFontSizeSte Sets the application-wide default style sheet to \fIsheet\fR, deleting any style sheet previously set. The ownership is transferred to QStyleSheet. .PP See also defaultSheet(). -.SH "QTextCustomItem * QStyleSheet::tag ( const TQString & name, const TQMap & attr, const TQString & context, const QMimeSourceFactory & factory, bool emptyTag, QTextDocument * doc ) const\fC [virtual]\fR" +.SH "TQTextCustomItem * QStyleSheet::tag ( const TQString & name, const TQMap & attr, const TQString & context, const QMimeSourceFactory & factory, bool emptyTag, TQTextDocument * doc ) const\fC [virtual]\fR" \fBThis function is under development and is subject to change.\fR .PP Generates an internal object for the tag called \fIname\fR, given the attributes \fIattr\fR, and using additional information provided by the mime source factory \fIfactory\fR. diff --git a/doc/man/man3/tqsyntaxhighlighter.3qt b/doc/man/man3/tqsyntaxhighlighter.3qt index d6cf2e71..15898d33 100644 --- a/doc/man/man3/tqsyntaxhighlighter.3qt +++ b/doc/man/man3/tqsyntaxhighlighter.3qt @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QSyntaxHighlighter \- Base class for implementing QTextEdit syntax highlighters +QSyntaxHighlighter \- Base class for implementing TQTextEdit syntax highlighters .SH SYNOPSIS \fC#include \fR .PP @@ -16,7 +16,7 @@ Inherits Qt. .SS "Public Members" .in +1c .ti -1c -.BI "\fBQSyntaxHighlighter\fR ( QTextEdit * textEdit )" +.BI "\fBQSyntaxHighlighter\fR ( TQTextEdit * textEdit )" .br .ti -1c .BI "virtual \fB~QSyntaxHighlighter\fR ()" @@ -34,7 +34,7 @@ Inherits Qt. .BI "void \fBsetFormat\fR ( int start, int count, const QFont & font )" .br .ti -1c -.BI "QTextEdit * \fBtextEdit\fR () const" +.BI "TQTextEdit * \fBtextEdit\fR () const" .br .ti -1c .BI "void \fBrehighlight\fR ()" @@ -44,17 +44,17 @@ Inherits Qt. .br .in -1c .SH DESCRIPTION -The QSyntaxHighlighter class is a base class for implementing QTextEdit syntax highlighters. +The QSyntaxHighlighter class is a base class for implementing TQTextEdit syntax highlighters. .PP -A syntax highligher automatically highlights parts of the text in a QTextEdit. Syntax highlighters are often used when the user is entering text in a specific format (for example, source code) and help the user to read the text and identify syntax errors. +A syntax highligher automatically highlights parts of the text in a TQTextEdit. Syntax highlighters are often used when the user is entering text in a specific format (for example, source code) and help the user to read the text and identify syntax errors. .PP -To provide your own syntax highlighting for QTextEdit, you must subclass QSyntaxHighlighter and reimplement highlightParagraph(). +To provide your own syntax highlighting for TQTextEdit, you must subclass QSyntaxHighlighter and reimplement highlightParagraph(). .PP -When you create an instance of your QSyntaxHighlighter subclass, pass it the QTextEdit that you want the syntax highlighting to be applied to. After this your highlightParagraph() function will be called automatically whenever necessary. Use your highlightParagraph() function to apply formatting (e.g. setting the font and color) to the text that is passed to it. +When you create an instance of your QSyntaxHighlighter subclass, pass it the TQTextEdit that you want the syntax highlighting to be applied to. After this your highlightParagraph() function will be called automatically whenever necessary. Use your highlightParagraph() function to apply formatting (e.g. setting the font and color) to the text that is passed to it. .PP See also Basic Widgets and Text Related Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QSyntaxHighlighter::QSyntaxHighlighter ( QTextEdit * textEdit )" +.SH "QSyntaxHighlighter::QSyntaxHighlighter ( TQTextEdit * textEdit )" Constructs the QSyntaxHighlighter and installs it on \fItextEdit\fR. .PP It is the caller's responsibility to delete the QSyntaxHighlighter when it is no longer needed. @@ -90,8 +90,8 @@ The specified \fIfont\fR and \fIcolor\fR are applied to the text from position \ This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .SH "void QSyntaxHighlighter::setFormat ( int start, int count, const QFont & font )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -.SH "QTextEdit * QSyntaxHighlighter::textEdit () const" -Returns the QTextEdit on which this syntax highlighter is +.SH "TQTextEdit * QSyntaxHighlighter::textEdit () const" +Returns the TQTextEdit on which this syntax highlighter is installed .SH "SEE ALSO" diff --git a/doc/man/man3/tqt.3qt b/doc/man/man3/tqt.3qt index 60086430..46022863 100644 --- a/doc/man/man3/tqt.3qt +++ b/doc/man/man3/tqt.3qt @@ -1220,7 +1220,7 @@ This enum is used in widgets that can display both plain text and rich text, e.g .TP \fCQt::AutoText\fR - The text string is interpreted as for RichText if QStyleSheet::mightBeRichText() returns TRUE, otherwise as PlainText. .TP -\fCQt::LogText\fR - A special, limited text format which is only used by QTextEdit in an optimized mode. +\fCQt::LogText\fR - A special, limited text format which is only used by TQTextEdit in an optimized mode. .SH "TQt::TimeSpec" .TP \fCQt::LocalTime\fR - Locale dependent time (Timezones and Daylight Savings Time) diff --git a/doc/man/man3/tqtextbrowser.3qt b/doc/man/man3/tqtextbrowser.3qt index f045cb4a..2caf9554 100644 --- a/doc/man/man3/tqtextbrowser.3qt +++ b/doc/man/man3/tqtextbrowser.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextBrowser 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextBrowser 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,16 +7,16 @@ .ad l .nh .SH NAME -QTextBrowser \- Rich text browser with hypertext navigation +TQTextBrowser \- Rich text browser with hypertext navigation .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QTextEdit. +Inherits TQTextEdit. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQTextBrowser\fR ( TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQTextBrowser\fR ( TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c .BI "TQString \fBsource\fR () const" @@ -89,13 +89,13 @@ Inherits QTextEdit. .br .in -1c .SH DESCRIPTION -The QTextBrowser class provides a rich text browser with hypertext navigation. +The TQTextBrowser class provides a rich text browser with hypertext navigation. .PP -This class extends QTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents. The contents of QTextEdit is set with setText(), but QTextBrowser has an additional function, setSource(), which makes it possible to set the text to a named document. The name is looked up in the text view's mime source factory. If a document name ends with an anchor (for example, "\fC#anchor"\fR), the text browser automatically scrolls to that position (using scrollToAnchor()). When the user clicks on a hyperlink, the browser will call setSource() itself, with the link's \fChref\fR value as argument. You can track the current source by connetion to the sourceChanged() signal. +This class extends TQTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents. The contents of TQTextEdit is set with setText(), but TQTextBrowser has an additional function, setSource(), which makes it possible to set the text to a named document. The name is looked up in the text view's mime source factory. If a document name ends with an anchor (for example, "\fC#anchor"\fR), the text browser automatically scrolls to that position (using scrollToAnchor()). When the user clicks on a hyperlink, the browser will call setSource() itself, with the link's \fChref\fR value as argument. You can track the current source by connetion to the sourceChanged() signal. .PP -QTextBrowser provides backward() and forward() slots which you can use to implement Back and Forward buttons. The home() slot sets the text to the very first document displayed. The linkClicked() signal is emitted when the user clicks a link. +TQTextBrowser provides backward() and forward() slots which you can use to implement Back and Forward buttons. The home() slot sets the text to the very first document displayed. The linkClicked() signal is emitted when the user clicks a link. .PP -By using QTextEdit::setMimeSourceFactory() you can provide your own subclass of QMimeSourceFactory. This makes it possible to access data from anywhere, for example from a network or from a database. See QMimeSourceFactory::data() for details. +By using TQTextEdit::setMimeSourceFactory() you can provide your own subclass of QMimeSourceFactory. This makes it possible to access data from anywhere, for example from a network or from a database. See QMimeSourceFactory::data() for details. .PP If you intend using the mime factory to read the data directly from the file system, you may have to specify the encoding for the file extension you are using. For example: .PP @@ -106,9 +106,9 @@ If you intend using the mime factory to read the data directly from the file sys .fi This is to ensure that the factory is able to resolve the document names. .PP -QTextBrowser interprets the tags it processes in accordance with the default style sheet. Change the style sheet with setStyleSheet(); see QStyleSheet for details. +TQTextBrowser interprets the tags it processes in accordance with the default style sheet. Change the style sheet with setStyleSheet(); see QStyleSheet for details. .PP -If you want to provide your users with editable rich text use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QSimpleRichText or QLabel. +If you want to provide your users with editable rich text use TQTextEdit. If you want a text browser without hypertext navigation use TQTextEdit, and use TQTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QSimpleRichText or QLabel. .PP .ce 1 .B "[Image Omitted]" @@ -119,41 +119,41 @@ If you want to provide your users with editable rich text use QTextEdit. If you .PP See also Advanced Widgets, Help System, and Text Related Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextBrowser::QTextBrowser ( TQWidget * parent = 0, const char * name = 0 )" -Constructs an empty QTextBrowser called \fIname\fR, with parent \fIparent\fR. -.SH "void QTextBrowser::anchorClicked ( const TQString & name, const TQString & link )\fC [signal]\fR" +.SH "TQTextBrowser::TQTextBrowser ( TQWidget * parent = 0, const char * name = 0 )" +Constructs an empty TQTextBrowser called \fIname\fR, with parent \fIparent\fR. +.SH "void TQTextBrowser::anchorClicked ( const TQString & name, const TQString & link )\fC [signal]\fR" This signal is emitted when the user clicks an anchor. The \fIlink\fR is the value of the \fChref\fR i.e. the name of the target document. The \fIname\fR is the name of the anchor. .PP See also linkClicked(). -.SH "void QTextBrowser::backward ()\fC [virtual slot]\fR" +.SH "void TQTextBrowser::backward ()\fC [virtual slot]\fR" Changes the document displayed to the previous document in the list of documents built by navigating links. Does nothing if there is no previous document. .PP See also forward() and backwardAvailable(). .PP Example: helpviewer/helpwindow.cpp. -.SH "void QTextBrowser::backwardAvailable ( bool available )\fC [signal]\fR" +.SH "void TQTextBrowser::backwardAvailable ( bool available )\fC [signal]\fR" This signal is emitted when the availability of backward() changes. \fIavailable\fR is FALSE when the user is at home(); otherwise it is TRUE. .PP Example: helpviewer/helpwindow.cpp. -.SH "void QTextBrowser::forward ()\fC [virtual slot]\fR" +.SH "void TQTextBrowser::forward ()\fC [virtual slot]\fR" Changes the document displayed to the next document in the list of documents built by navigating links. Does nothing if there is no next document. .PP See also backward() and forwardAvailable(). .PP Example: helpviewer/helpwindow.cpp. -.SH "void QTextBrowser::forwardAvailable ( bool available )\fC [signal]\fR" +.SH "void TQTextBrowser::forwardAvailable ( bool available )\fC [signal]\fR" This signal is emitted when the availability of forward() changes. \fIavailable\fR is TRUE after the user navigates backward() and FALSE when the user navigates or goes forward(). .PP Example: helpviewer/helpwindow.cpp. -.SH "void QTextBrowser::highlighted ( const TQString & link )\fC [signal]\fR" +.SH "void TQTextBrowser::highlighted ( const TQString & link )\fC [signal]\fR" This signal is emitted when the user has selected but not activated a link in the document. \fIlink\fR is the value of the \fChref\fR i.e. the name of the target document. .PP Example: helpviewer/helpwindow.cpp. -.SH "void QTextBrowser::home ()\fC [virtual slot]\fR" +.SH "void TQTextBrowser::home ()\fC [virtual slot]\fR" Changes the document displayed to be the first document the browser displayed. .PP Example: helpviewer/helpwindow.cpp. -.SH "void QTextBrowser::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR" +.SH "void TQTextBrowser::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR" The event \fIe\fR is used to provide the following keyboard shortcuts:
    .nf .TS l - l. Keypress Action Alt+Left Arrow backward() Alt+Right Arrow forward() Alt+Up Arrow @@ -161,20 +161,20 @@ l - l. Keypress Action Alt+Left Arrow backward() Alt+Right Arrow forward() Alt+U .fi
    .PP -Reimplemented from QTextEdit. -.SH "void QTextBrowser::linkClicked ( const TQString & link )\fC [signal]\fR" +Reimplemented from TQTextEdit. +.SH "void TQTextBrowser::linkClicked ( const TQString & link )\fC [signal]\fR" This signal is emitted when the user clicks a link. The \fIlink\fR is the value of the \fChref\fR i.e. the name of the target document. .PP The \fIlink\fR will be the absolute location of the document, based on the value of the anchor's href tag and the current context of the document. .PP See also anchorClicked() and context(). -.SH "void QTextBrowser::reload ()\fC [virtual slot]\fR" +.SH "void TQTextBrowser::reload ()\fC [virtual slot]\fR" Reloads the current set source. -.SH "void QTextBrowser::setSource ( const TQString & name )\fC [virtual slot]\fR" +.SH "void TQTextBrowser::setSource ( const TQString & name )\fC [virtual slot]\fR" Sets the name of the displayed document to \fIname\fR. See the "source" property for details. -.SH "TQString QTextBrowser::source () const" +.SH "TQString TQTextBrowser::source () const" Returns the name of the displayed document. See the "source" property for details. -.SH "void QTextBrowser::sourceChanged ( const TQString & src )\fC [signal]\fR" +.SH "void TQTextBrowser::sourceChanged ( const TQString & src )\fC [signal]\fR" This signal is emitted when the mime source has changed, \fIsrc\fR being the new source. .PP Source changes happen both programmatically when calling setSource(), forward(), backword() or home() or when the user clicks on links or presses the equivalent key sequences. @@ -206,7 +206,7 @@ This property holds whether undo and redo are enabled. .PP .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqtextbrowser.html +.BR http://doc.trolltech.com/tqtextbrowser.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextcodec.3qt b/doc/man/man3/tqtextcodec.3qt index a16d0059..25beae66 100644 --- a/doc/man/man3/tqtextcodec.3qt +++ b/doc/man/man3/tqtextcodec.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextCodec 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextCodec 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,18 +7,18 @@ .ad l .nh .SH NAME -QTextCodec \- Conversion between text encodings +TQTextCodec \- Conversion between text encodings .SH SYNOPSIS -Almost all the functions in this class are reentrant when TQt is built with thread support. The exceptions are \fB~QTextCodec\fR(), \fBsetCodecForTr\fR(), \fBsetCodecForCStrings\fR(), and \fBQTextCodec\fR().

    +Almost all the functions in this class are reentrant when TQt is built with thread support. The exceptions are \fB~TQTextCodec\fR(), \fBsetCodecForTr\fR(), \fBsetCodecForCStrings\fR(), and \fBTQTextCodec\fR().

    .PP -\fC#include \fR +\fC#include \fR .PP Inherited by QBig5Codec, QBig5hkscsCodec, QEucJpCodec, QEucKrCodec, QGb18030Codec, QJisCodec, QHebrewCodec, QSjisCodec, and QTsciiCodec. .PP .SS "Public Members" .in +1c .ti -1c -.BI "virtual \fB~QTextCodec\fR ()" +.BI "virtual \fB~TQTextCodec\fR ()" .br .ti -1c .BI "virtual const char * \fBname\fR () const = 0" @@ -30,10 +30,10 @@ Inherited by QBig5Codec, QBig5hkscsCodec, QEucJpCodec, QEucKrCodec, QGb18030Code .BI "virtual int \fBmibEnum\fR () const = 0" .br .ti -1c -.BI "virtual QTextDecoder * \fBmakeDecoder\fR () const" +.BI "virtual TQTextDecoder * \fBmakeDecoder\fR () const" .br .ti -1c -.BI "virtual QTextEncoder * \fBmakeEncoder\fR () const" +.BI "virtual TQTextEncoder * \fBmakeEncoder\fR () const" .br .ti -1c .BI "virtual TQString \fBtoUnicode\fR ( const char * chars, int len ) const" @@ -75,40 +75,40 @@ Inherited by QBig5Codec, QBig5hkscsCodec, QEucJpCodec, QEucKrCodec, QGb18030Code .SS "Static Public Members" .in +1c .ti -1c -.BI "QTextCodec * \fBloadCharmap\fR ( TQIODevice * iod )" +.BI "TQTextCodec * \fBloadCharmap\fR ( TQIODevice * iod )" .br .ti -1c -.BI "QTextCodec * \fBloadCharmapFile\fR ( TQString filename )" +.BI "TQTextCodec * \fBloadCharmapFile\fR ( TQString filename )" .br .ti -1c -.BI "QTextCodec * \fBcodecForMib\fR ( int mib )" +.BI "TQTextCodec * \fBcodecForMib\fR ( int mib )" .br .ti -1c -.BI "QTextCodec * \fBcodecForName\fR ( const char * name, int accuracy = 0 )" +.BI "TQTextCodec * \fBcodecForName\fR ( const char * name, int accuracy = 0 )" .br .ti -1c -.BI "QTextCodec * \fBcodecForContent\fR ( const char * chars, int len )" +.BI "TQTextCodec * \fBcodecForContent\fR ( const char * chars, int len )" .br .ti -1c -.BI "QTextCodec * \fBcodecForIndex\fR ( int i )" +.BI "TQTextCodec * \fBcodecForIndex\fR ( int i )" .br .ti -1c -.BI "QTextCodec * \fBcodecForLocale\fR ()" +.BI "TQTextCodec * \fBcodecForLocale\fR ()" .br .ti -1c -.BI "void \fBsetCodecForLocale\fR ( QTextCodec * c )" +.BI "void \fBsetCodecForLocale\fR ( TQTextCodec * c )" .br .ti -1c -.BI "QTextCodec * \fBcodecForTr\fR ()" +.BI "TQTextCodec * \fBcodecForTr\fR ()" .br .ti -1c -.BI "void \fBsetCodecForTr\fR ( QTextCodec * c )" +.BI "void \fBsetCodecForTr\fR ( TQTextCodec * c )" .br .ti -1c -.BI "QTextCodec * \fBcodecForCStrings\fR ()" +.BI "TQTextCodec * \fBcodecForCStrings\fR ()" .br .ti -1c -.BI "void \fBsetCodecForCStrings\fR ( QTextCodec * c )" +.BI "void \fBsetCodecForCStrings\fR ( TQTextCodec * c )" .br .ti -1c .BI "void \fBdeleteAllCodecs\fR ()" @@ -120,7 +120,7 @@ Inherited by QBig5Codec, QBig5hkscsCodec, QEucJpCodec, QEucKrCodec, QGb18030Code .SS "Protected Members" .in +1c .ti -1c -.BI "\fBQTextCodec\fR ()" +.BI "\fBTQTextCodec\fR ()" .br .in -1c .SS "Static Protected Members" @@ -130,11 +130,11 @@ Inherited by QBig5Codec, QBig5hkscsCodec, QEucJpCodec, QEucKrCodec, QGb18030Code .br .in -1c .SH DESCRIPTION -The QTextCodec class provides conversion between text encodings. +The TQTextCodec class provides conversion between text encodings. .PP Qt uses Unicode to store, draw and manipulate strings. In many situations you may wish to deal with data that uses a different encoding. For example, most Japanese documents are still stored in Shift-JIS or ISO2022, while Russian users often have their documents in KOI8-R or CP1251. .PP -Qt provides a set of QTextCodec classes to help with converting non-Unicode formats to and from Unicode. You can also create your own codec classes (see later). +Qt provides a set of TQTextCodec classes to help with converting non-Unicode formats to and from Unicode. You can also create your own codec classes (see later). .PP The supported encodings are: .TP @@ -224,13 +224,13 @@ Apple Roman .TP TIS-620 -- Thai .PP -QTextCodecs can be used as follows to convert some locally encoded string to Unicode. Suppose you have some string encoded in Russian KOI8-R encoding, and want to convert it to Unicode. The simple way to do this is: +TQTextCodecs can be used as follows to convert some locally encoded string to Unicode. Suppose you have some string encoded in Russian KOI8-R encoding, and want to convert it to Unicode. The simple way to do this is: .PP .nf .br QCString locallyEncoded = "..."; // text to convert .br - QTextCodec *codec = QTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R + TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R .br TQString unicodeString = codec->toUnicode( locallyEncoded ); .br @@ -242,7 +242,7 @@ After this, \fCunicodeString\fR holds the text converted to Unicode. Converting .br TQString unicodeString = "..."; // any Unicode text .br - QTextCodec *codec = QTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R + TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R .br QCString locallyEncoded = codec->fromUnicode( unicodeString ); .br @@ -250,13 +250,13 @@ After this, \fCunicodeString\fR holds the text converted to Unicode. Converting .PP Some care must be taken when trying to convert the data in chunks, for example, when receiving it over a network. In such cases it is possible that a multi-byte character will be split over two chunks. At best this might result in the loss of a character and at worst cause the entire conversion to fail. .PP -The approach to use in these situations is to create a QTextDecoder object for the codec and use this QTextDecoder for the whole decoding process, as shown below: +The approach to use in these situations is to create a TQTextDecoder object for the codec and use this TQTextDecoder for the whole decoding process, as shown below: .PP .nf .br - QTextCodec *codec = QTextCodec::codecForName( "Shift-JIS" ); + TQTextCodec *codec = TQTextCodec::codecForName( "Shift-JIS" ); .br - QTextDecoder *decoder = codec->makeDecoder(); + TQTextDecoder *decoder = codec->makeDecoder(); .br .br TQString unicodeString; @@ -271,17 +271,17 @@ The approach to use in these situations is to create a QTextDecoder object for t .br .fi .PP -The QTextDecoder object maintains state between chunks and therefore works correctly even if a multi-byte character is split between chunks. +The TQTextDecoder object maintains state between chunks and therefore works correctly even if a multi-byte character is split between chunks. .SH "Creating your own Codec class" -Support for new text encodings can be added to TQt by creating QTextCodec subclasses. +Support for new text encodings can be added to TQt by creating TQTextCodec subclasses. .PP -Built-in codecs can be overridden by custom codecs since more recently created QTextCodec objects take precedence over earlier ones. +Built-in codecs can be overridden by custom codecs since more recently created TQTextCodec objects take precedence over earlier ones. .PP You may find it more convenient to make your codec class available as a plugin; see the plugin documentation for more details. .PP -The abstract virtual functions describe the encoder to the system and the coder is used as required in the different text file formats supported by QTextStream, and under X11, for the locale-specific character input and output. +The abstract virtual functions describe the encoder to the system and the coder is used as required in the different text file formats supported by TQTextStream, and under X11, for the locale-specific character input and output. .PP -To add support for another 8-bit encoding to Qt, make a subclass of QTextCodec and implement at least the following methods: +To add support for another 8-bit encoding to Qt, make a subclass of TQTextCodec and implement at least the following methods: .PP .nf .br @@ -301,10 +301,10 @@ If the encoding is multi-byte then it will have "state"; that is, the interpreta .PP .nf .br - QTextDecoder* makeDecoder() const + TQTextDecoder* makeDecoder() const .br .fi -Return a QTextDecoder that remembers incomplete multi-byte sequence prefixes or other required state. +Return a TQTextDecoder that remembers incomplete multi-byte sequence prefixes or other required state. .PP If the encoding does \fInot\fR require state, you should implement: .PP @@ -315,16 +315,16 @@ If the encoding does \fInot\fR require state, you should implement: .fi Converts \fIlen\fR characters from \fIchars\fR to Unicode. .PP -The base QTextCodec class has default implementations of the above two functions, \fIbut they are mutually recursive\fR, so you must re-implement at least one of them, or both for improved efficiency. +The base TQTextCodec class has default implementations of the above two functions, \fIbut they are mutually recursive\fR, so you must re-implement at least one of them, or both for improved efficiency. .PP For conversion from Unicode to 8-bit encodings, it is rarely necessary to maintain state. However, two functions similar to the two above are used for encoding: .PP .nf .br - QTextEncoder* makeEncoder() const + TQTextEncoder* makeEncoder() const .br .fi -Return a QTextEncoder. +Return a TQTextEncoder. .PP .nf .br @@ -346,7 +346,7 @@ Gives a value indicating how likely it is that \fIlen\fR characters from \fIchar .PP A good model for this function is the QWindowsLocalCodec::heuristicContentMatch function found in the TQt sources. .PP -A QTextCodec subclass might have improved performance if you also re-implement: +A TQTextCodec subclass might have improved performance if you also re-implement: .PP .nf .br @@ -373,26 +373,26 @@ Codecs can also be created as plugins. .PP See also Internationalization with Qt. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextCodec::QTextCodec ()\fC [protected]\fR" +.SH "TQTextCodec::TQTextCodec ()\fC [protected]\fR" \fBWarning:\fR This function is \fInot\fR reentrant.

    .PP -Constructs a QTextCodec, and gives it the highest precedence. The QTextCodec should always be constructed on the heap (i.e. with \fCnew\fR). TQt takes ownership and will delete it when the application terminates. -.SH "QTextCodec::~QTextCodec ()\fC [virtual]\fR" +Constructs a TQTextCodec, and gives it the highest precedence. The TQTextCodec should always be constructed on the heap (i.e. with \fCnew\fR). TQt takes ownership and will delete it when the application terminates. +.SH "TQTextCodec::~TQTextCodec ()\fC [virtual]\fR" \fBWarning:\fR This function is \fInot\fR reentrant.

    .PP -Destroys the QTextCodec. Note that you should not delete codecs yourself: once created they become Qt's responsibility. -.SH "bool QTextCodec::canEncode ( TQChar ch ) const\fC [virtual]\fR" +Destroys the TQTextCodec. Note that you should not delete codecs yourself: once created they become Qt's responsibility. +.SH "bool TQTextCodec::canEncode ( TQChar ch ) const\fC [virtual]\fR" Returns TRUE if the Unicode character \fIch\fR can be fully encoded with this codec; otherwise returns FALSE. The default implementation tests if the result of toUnicode(fromUnicode(ch)) is the original \fIch\fR. Subclasses may be able to improve the efficiency. -.SH "bool QTextCodec::canEncode ( const TQString & s ) const\fC [virtual]\fR" +.SH "bool TQTextCodec::canEncode ( const TQString & s ) const\fC [virtual]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIs\fR contains the string being tested for encode-ability. -.SH "QTextCodec * QTextCodec::codecForCStrings ()\fC [static]\fR" +.SH "TQTextCodec * TQTextCodec::codecForCStrings ()\fC [static]\fR" Returns the codec used by TQString to convert to and from const char* and QCStrings. If this function returns 0 (the default), TQString assumes Latin-1. .PP See also setCodecForCStrings(). -.SH "QTextCodec * QTextCodec::codecForContent ( const char * chars, int len )\fC [static]\fR" -Searches all installed QTextCodec objects, returning the one which most recognizes the given content. May return 0. +.SH "TQTextCodec * TQTextCodec::codecForContent ( const char * chars, int len )\fC [static]\fR" +Searches all installed TQTextCodec objects, returning the one which most recognizes the given content. May return 0. .PP Note that this is often a poor choice, since character encodings often use most of the available character sequences, and so only by linguistic analysis could a true match be made. .PP @@ -401,99 +401,99 @@ Note that this is often a poor choice, since character encodings often use most See also heuristicContentMatch(). .PP Example: qwerty/qwerty.cpp. -.SH "QTextCodec * QTextCodec::codecForIndex ( int i )\fC [static]\fR" -Returns the QTextCodec \fIi\fR positions from the most recently inserted codec, or 0 if there is no such QTextCodec. Thus, codecForIndex(0) returns the most recently created QTextCodec. +.SH "TQTextCodec * TQTextCodec::codecForIndex ( int i )\fC [static]\fR" +Returns the TQTextCodec \fIi\fR positions from the most recently inserted codec, or 0 if there is no such TQTextCodec. Thus, codecForIndex(0) returns the most recently created TQTextCodec. .PP Example: qwerty/qwerty.cpp. -.SH "QTextCodec * QTextCodec::codecForLocale ()\fC [static]\fR" +.SH "TQTextCodec * TQTextCodec::codecForLocale ()\fC [static]\fR" Returns a pointer to the codec most suitable for this locale. .PP Example: qwerty/qwerty.cpp. -.SH "QTextCodec * QTextCodec::codecForMib ( int mib )\fC [static]\fR" -Returns the QTextCodec which matches the MIBenum \fImib\fR. -.SH "QTextCodec * QTextCodec::codecForName ( const char * name, int accuracy = 0 )\fC [static]\fR" -Searches all installed QTextCodec objects and returns the one which best matches \fIname\fR; the match is case-insensitive. Returns 0 if no codec's heuristicNameMatch() reports a match better than \fIaccuracy\fR, or if \fIname\fR is a null string. +.SH "TQTextCodec * TQTextCodec::codecForMib ( int mib )\fC [static]\fR" +Returns the TQTextCodec which matches the MIBenum \fImib\fR. +.SH "TQTextCodec * TQTextCodec::codecForName ( const char * name, int accuracy = 0 )\fC [static]\fR" +Searches all installed TQTextCodec objects and returns the one which best matches \fIname\fR; the match is case-insensitive. Returns 0 if no codec's heuristicNameMatch() reports a match better than \fIaccuracy\fR, or if \fIname\fR is a null string. .PP See also heuristicNameMatch(). -.SH "QTextCodec * QTextCodec::codecForTr ()\fC [static]\fR" +.SH "TQTextCodec * TQTextCodec::codecForTr ()\fC [static]\fR" Returns the codec used by TQObject::tr() on its argument. If this function returns 0 (the default), tr() assumes Latin-1. .PP See also setCodecForTr(). -.SH "void QTextCodec::deleteAllCodecs ()\fC [static]\fR" +.SH "void TQTextCodec::deleteAllCodecs ()\fC [static]\fR" Deletes all the created codecs. .PP \fBWarning:\fR Do not call this function. .PP -QApplication calls this function just before exiting to delete any QTextCodec objects that may be lying around. Since various other classes hold pointers to QTextCodec objects, it is not safe to call this function earlier. +QApplication calls this function just before exiting to delete any TQTextCodec objects that may be lying around. Since various other classes hold pointers to TQTextCodec objects, it is not safe to call this function earlier. .PP -If you are using the utility classes (like TQString) but not using QApplication, calling this function at the very end of your application may be helpful for chasing down memory leaks by eliminating any QTextCodec objects. -.SH "QCString QTextCodec::fromUnicode ( const TQString & uc, int & lenInOut ) const\fC [virtual]\fR" -QTextCodec subclasses must reimplement either this function or makeEncoder(). It converts the first \fIlenInOut\fR characters of \fIuc\fR from Unicode to the encoding of the subclass. If \fIlenInOut\fR is negative or too large, the length of \fIuc\fR is used instead. +If you are using the utility classes (like TQString) but not using QApplication, calling this function at the very end of your application may be helpful for chasing down memory leaks by eliminating any TQTextCodec objects. +.SH "QCString TQTextCodec::fromUnicode ( const TQString & uc, int & lenInOut ) const\fC [virtual]\fR" +TQTextCodec subclasses must reimplement either this function or makeEncoder(). It converts the first \fIlenInOut\fR characters of \fIuc\fR from Unicode to the encoding of the subclass. If \fIlenInOut\fR is negative or too large, the length of \fIuc\fR is used instead. .PP Converts \fIlenInOut\fR characters (not bytes) from \fIuc\fR, producing a QCString. \fIlenInOut\fR will be set to the length of the result (in bytes). .PP The default implementation makes an encoder with makeEncoder() and converts the input with that. Note that the default makeEncoder() implementation makes an encoder that simply calls this function, hence subclasses \fImust\fR reimplement one function or the other to avoid infinite recursion. .PP Reimplemented in QHebrewCodec. -.SH "QCString QTextCodec::fromUnicode ( const TQString & uc ) const" +.SH "QCString TQTextCodec::fromUnicode ( const TQString & uc ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIuc\fR is the unicode source string. -.SH "int QTextCodec::heuristicContentMatch ( const char * chars, int len ) const\fC [pure virtual]\fR" -QTextCodec subclasses must reimplement this function. It examines the first \fIlen\fR bytes of \fIchars\fR and returns a value indicating how likely it is that the string is a prefix of text encoded in the encoding of the subclass. A negative return value indicates that the text is detectably not in the encoding (e.g. it contains characters undefined in the encoding). A return value of 0 indicates that the text should be decoded with this codec rather than as ASCII, but there is no particular evidence. The value should range up to \fIlen\fR. Thus, most decoders will return -1, 0, or -\fIlen\fR. +.SH "int TQTextCodec::heuristicContentMatch ( const char * chars, int len ) const\fC [pure virtual]\fR" +TQTextCodec subclasses must reimplement this function. It examines the first \fIlen\fR bytes of \fIchars\fR and returns a value indicating how likely it is that the string is a prefix of text encoded in the encoding of the subclass. A negative return value indicates that the text is detectably not in the encoding (e.g. it contains characters undefined in the encoding). A return value of 0 indicates that the text should be decoded with this codec rather than as ASCII, but there is no particular evidence. The value should range up to \fIlen\fR. Thus, most decoders will return -1, 0, or -\fIlen\fR. .PP The characters are not null terminated. .PP See also codecForContent(). -.SH "int QTextCodec::heuristicNameMatch ( const char * hint ) const\fC [virtual]\fR" +.SH "int TQTextCodec::heuristicNameMatch ( const char * hint ) const\fC [virtual]\fR" Returns a value indicating how likely it is that this decoder is appropriate for decoding some format that has the given name. The name is compared with the \fIhint\fR. .PP A good match returns a positive number around the length of the string. A bad match is negative. .PP The default implementation calls simpleHeuristicNameMatch() with the name of the codec. -.SH "QTextCodec * QTextCodec::loadCharmap ( TQIODevice * iod )\fC [static]\fR" +.SH "TQTextCodec * TQTextCodec::loadCharmap ( TQIODevice * iod )\fC [static]\fR" Reads a POSIX2 charmap definition from \fIiod\fR. The parser recognizes the following lines: .PP \fIname\fR
    \fIcharacter\fR
    % alias \fIalias\fR
    CHARMAP
    <\fItoken\fR> /x\fIhexbyte\fR ...
    <\fItoken\fR> /d\fIdecbyte\fR ...
    <\fItoken\fR> /\fIoctbyte\fR ...
    <\fItoken\fR> /\fIany\fR/\fIany\fR... ...
    END CHARMAP
    .PP -The resulting QTextCodec is returned (and also added to the global list of codecs). The name() of the result is taken from the code_set_name. +The resulting TQTextCodec is returned (and also added to the global list of codecs). The name() of the result is taken from the code_set_name. .PP -Note that a codec constructed in this way uses much more memory and is slower than a hand-written QTextCodec subclass, since tables in code are kept in memory shared by all TQt applications. +Note that a codec constructed in this way uses much more memory and is slower than a hand-written TQTextCodec subclass, since tables in code are kept in memory shared by all TQt applications. .PP See also loadCharmapFile(). .PP Example: qwerty/qwerty.cpp. -.SH "QTextCodec * QTextCodec::loadCharmapFile ( TQString filename )\fC [static]\fR" +.SH "TQTextCodec * TQTextCodec::loadCharmapFile ( TQString filename )\fC [static]\fR" A convenience function for loadCharmap() that loads the charmap definition from the file \fIfilename\fR. -.SH "const char * QTextCodec::locale ()\fC [static]\fR" +.SH "const char * TQTextCodec::locale ()\fC [static]\fR" Returns a string representing the current language and sublanguage, e.g. "pt" for Portuguese, or "pt_br" for Portuguese/Brazil. .PP Example: i18n/main.cpp. -.SH "QTextDecoder * QTextCodec::makeDecoder () const\fC [virtual]\fR" -Creates a QTextDecoder which stores enough state to decode chunks of char* data to create chunks of Unicode data. The default implementation creates a stateless decoder, which is only sufficient for the simplest encodings where each byte corresponds to exactly one Unicode character. +.SH "TQTextDecoder * TQTextCodec::makeDecoder () const\fC [virtual]\fR" +Creates a TQTextDecoder which stores enough state to decode chunks of char* data to create chunks of Unicode data. The default implementation creates a stateless decoder, which is only sufficient for the simplest encodings where each byte corresponds to exactly one Unicode character. .PP The caller is responsible for deleting the returned object. -.SH "QTextEncoder * QTextCodec::makeEncoder () const\fC [virtual]\fR" -Creates a QTextEncoder which stores enough state to encode chunks of Unicode data as char* data. The default implementation creates a stateless encoder, which is only sufficient for the simplest encodings where each Unicode character corresponds to exactly one character. +.SH "TQTextEncoder * TQTextCodec::makeEncoder () const\fC [virtual]\fR" +Creates a TQTextEncoder which stores enough state to encode chunks of Unicode data as char* data. The default implementation creates a stateless encoder, which is only sufficient for the simplest encodings where each Unicode character corresponds to exactly one character. .PP The caller is responsible for deleting the returned object. -.SH "int QTextCodec::mibEnum () const\fC [pure virtual]\fR" -Subclasses of QTextCodec must reimplement this function. It returns the MIBenum (see the IANA character-sets encoding file for more information). It is important that each QTextCodec subclass returns the correct unique value for this function. +.SH "int TQTextCodec::mibEnum () const\fC [pure virtual]\fR" +Subclasses of TQTextCodec must reimplement this function. It returns the MIBenum (see the IANA character-sets encoding file for more information). It is important that each TQTextCodec subclass returns the correct unique value for this function. .PP Reimplemented in QEucJpCodec. -.SH "const char * QTextCodec::mimeName () const\fC [virtual]\fR" +.SH "const char * TQTextCodec::mimeName () const\fC [virtual]\fR" Returns the preferred mime name of the encoding as defined in the IANA character-sets encoding file. .PP Reimplemented in QEucJpCodec, QEucKrCodec, QJisCodec, QHebrewCodec, and QSjisCodec. -.SH "const char * QTextCodec::name () const\fC [pure virtual]\fR" -QTextCodec subclasses must reimplement this function. It returns the name of the encoding supported by the subclass. When choosing a name for an encoding, consider these points: +.SH "const char * TQTextCodec::name () const\fC [pure virtual]\fR" +TQTextCodec subclasses must reimplement this function. It returns the name of the encoding supported by the subclass. When choosing a name for an encoding, consider these points: .TP -On X11, heuristicNameMatch( const char * hint ) is used to test if a the QTextCodec can convert between Unicode and the encoding of a font with encoding \fIhint\fR, such as "iso8859-1" for Latin-1 fonts," koi8-r" for Russian KOI8 fonts. The default algorithm of heuristicNameMatch() uses name(). +On X11, heuristicNameMatch( const char * hint ) is used to test if a the TQTextCodec can convert between Unicode and the encoding of a font with encoding \fIhint\fR, such as "iso8859-1" for Latin-1 fonts," koi8-r" for Russian KOI8 fonts. The default algorithm of heuristicNameMatch() uses name(). .TP Some applications may use this function to present encodings to the end user. .PP Example: qwerty/qwerty.cpp. -.SH "void QTextCodec::setCodecForCStrings ( QTextCodec * c )\fC [static]\fR" +.SH "void TQTextCodec::setCodecForCStrings ( TQTextCodec * c )\fC [static]\fR" \fBWarning:\fR This function is \fInot\fR reentrant.

    .PP Sets the codec used by TQString to convert to and from const char* and QCStrings. If \fIc\fR is 0 (the default), TQString assumes Latin-1. @@ -501,11 +501,11 @@ Sets the codec used by TQString to convert to and from const char* and QCStrings \fBWarning:\fR Some codecs do not preserve the characters in the ascii range (0x00 to 0x7f). For example, the Japanese Shift-JIS encoding maps the backslash character (0x5a) to the Yen character. This leads to unexpected results when using the backslash character to escape characters in strings used in e.g. regular expressions. Use TQString::fromLatin1() to preserve characters in the ascii range when needed. .PP See also codecForCStrings() and setCodecForTr(). -.SH "void QTextCodec::setCodecForLocale ( QTextCodec * c )\fC [static]\fR" +.SH "void TQTextCodec::setCodecForLocale ( TQTextCodec * c )\fC [static]\fR" Set the codec to \fIc\fR; this will be returned by codecForLocale(). This might be needed for some applications that want to use their own mechanism for setting the locale. .PP See also codecForLocale(). -.SH "void QTextCodec::setCodecForTr ( QTextCodec * c )\fC [static]\fR" +.SH "void TQTextCodec::setCodecForTr ( TQTextCodec * c )\fC [static]\fR" \fBWarning:\fR This function is \fInot\fR reentrant.

    .PP Sets the codec used by TQObject::tr() on its argument to \fIc\fR. If \fIc\fR is 0 (the default), tr() assumes Latin-1. @@ -522,7 +522,7 @@ If the literal quoted text in the program is not in the Latin-1 encoding, this f .br ... install any additional codecs ... .br - QTextCodec::setCodecForTr( QTextCodec::codecForName("eucKR") ); + TQTextCodec::setCodecForTr( TQTextCodec::codecForName("eucKR") ); .br ... .br @@ -533,35 +533,35 @@ If the literal quoted text in the program is not in the Latin-1 encoding, this f Note that this is not the way to select the encoding that the \fIuser\fR has chosen. For example, to convert an application containing literal English strings to Korean, all that is needed is for the English strings to be passed through tr() and for translation files to be loaded. For details of internationalization, see the TQt internationalization documentation. .PP See also codecForTr() and setCodecForCStrings(). -.SH "int QTextCodec::simpleHeuristicNameMatch ( const char * name, const char * hint )\fC [static protected]\fR" +.SH "int TQTextCodec::simpleHeuristicNameMatch ( const char * name, const char * hint )\fC [static protected]\fR" A simple utility function for heuristicNameMatch(): it does some very minor character-skipping so that almost-exact matches score high. \fIname\fR is the text we're matching and \fIhint\fR is used for the comparison. -.SH "TQString QTextCodec::toUnicode ( const char * chars, int len ) const\fC [virtual]\fR" -QTextCodec subclasses must reimplement this function or makeDecoder(). It converts the first \fIlen\fR characters of \fIchars\fR to Unicode. +.SH "TQString TQTextCodec::toUnicode ( const char * chars, int len ) const\fC [virtual]\fR" +TQTextCodec subclasses must reimplement this function or makeDecoder(). It converts the first \fIlen\fR characters of \fIchars\fR to Unicode. .PP The default implementation makes a decoder with makeDecoder() and converts the input with that. Note that the default makeDecoder() implementation makes a decoder that simply calls this function, hence subclasses \fImust\fR reimplement one function or the other to avoid infinite recursion. -.SH "TQString QTextCodec::toUnicode ( const QByteArray & a, int len ) const" +.SH "TQString TQTextCodec::toUnicode ( const QByteArray & a, int len ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIa\fR contains the source characters; \fIlen\fR contains the number of characters in \fIa\fR to use. -.SH "TQString QTextCodec::toUnicode ( const QByteArray & a ) const" +.SH "TQString TQTextCodec::toUnicode ( const QByteArray & a ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIa\fR contains the source characters. -.SH "TQString QTextCodec::toUnicode ( const QCString & a, int len ) const" +.SH "TQString TQTextCodec::toUnicode ( const QCString & a, int len ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIa\fR contains the source characters; \fIlen\fR contains the number of characters in \fIa\fR to use. -.SH "TQString QTextCodec::toUnicode ( const QCString & a ) const" +.SH "TQString TQTextCodec::toUnicode ( const QCString & a ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIa\fR contains the source characters. -.SH "TQString QTextCodec::toUnicode ( const char * chars ) const" +.SH "TQString TQTextCodec::toUnicode ( const char * chars ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fIchars\fR contains the source characters. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqtextcodec.html +.BR http://doc.trolltech.com/tqtextcodec.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextcodecplugin.3qt b/doc/man/man3/tqtextcodecplugin.3qt index a3dfe093..d03ad19a 100644 --- a/doc/man/man3/tqtextcodecplugin.3qt +++ b/doc/man/man3/tqtextcodecplugin.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextCodecPlugin 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextCodecPlugin 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,35 +7,35 @@ .ad l .nh .SH NAME -QTextCodecPlugin \- Abstract base for custom QTextCodec plugins +TQTextCodecPlugin \- Abstract base for custom TQTextCodec plugins .SH SYNOPSIS All the functions in this class are reentrant when TQt is built with thread support.

    .PP -\fC#include \fR +\fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQTextCodecPlugin\fR ()" +.BI "\fBTQTextCodecPlugin\fR ()" .br .ti -1c -.BI "\fB~QTextCodecPlugin\fR ()" +.BI "\fB~TQTextCodecPlugin\fR ()" .br .ti -1c .BI "virtual TQStringList \fBnames\fR () const = 0" .br .ti -1c -.BI "virtual QTextCodec * \fBcreateForName\fR ( const TQString & name ) = 0" +.BI "virtual TQTextCodec * \fBcreateForName\fR ( const TQString & name ) = 0" .br .ti -1c .BI "virtual TQValueList \fBmibEnums\fR () const = 0" .br .ti -1c -.BI "virtual QTextCodec * \fBcreateForMib\fR ( int mib ) = 0" +.BI "virtual TQTextCodec * \fBcreateForMib\fR ( int mib ) = 0" .br .in -1c .SH DESCRIPTION -The QTextCodecPlugin class provides an abstract base for custom QTextCodec plugins. +The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. .PP The text codec plugin is a simple plugin interface that makes it easy to create custom text codecs that can be loaded dynamically into applications. .PP @@ -45,33 +45,33 @@ See the IANA character-sets encoding file for more information on mime names and .PP See also Plugins. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextCodecPlugin::QTextCodecPlugin ()" +.SH "TQTextCodecPlugin::TQTextCodecPlugin ()" Constructs a text codec plugin. This is invoked automatically by the \fCQ_EXPORT_PLUGIN\fR macro. -.SH "QTextCodecPlugin::~QTextCodecPlugin ()" +.SH "TQTextCodecPlugin::~TQTextCodecPlugin ()" Destroys the text codec plugin. .PP You never have to call this explicitly. TQt destroys a plugin automatically when it is no longer used. -.SH "QTextCodec * QTextCodecPlugin::createForMib ( int mib )\fC [pure virtual]\fR" -Creates a QTextCodec object for the mib enum \fImib\fR. +.SH "TQTextCodec * TQTextCodecPlugin::createForMib ( int mib )\fC [pure virtual]\fR" +Creates a TQTextCodec object for the mib enum \fImib\fR. .PP (See the IANA character-sets encoding file for more information) .PP See also mibEnums(). -.SH "QTextCodec * QTextCodecPlugin::createForName ( const TQString & name )\fC [pure virtual]\fR" -Creates a QTextCodec object for the codec called \fIname\fR. +.SH "TQTextCodec * TQTextCodecPlugin::createForName ( const TQString & name )\fC [pure virtual]\fR" +Creates a TQTextCodec object for the codec called \fIname\fR. .PP See also names(). -.SH "TQValueList QTextCodecPlugin::mibEnums () const\fC [pure virtual]\fR" +.SH "TQValueList TQTextCodecPlugin::mibEnums () const\fC [pure virtual]\fR" Returns the list of mib enums supported by this plugin. .PP See also createForMib(). -.SH "TQStringList QTextCodecPlugin::names () const\fC [pure virtual]\fR" +.SH "TQStringList TQTextCodecPlugin::names () const\fC [pure virtual]\fR" Returns the list of mime names supported by this plugin. .PP See also createForName(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqtextcodecplugin.html +.BR http://doc.trolltech.com/tqtextcodecplugin.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextdecoder.3qt b/doc/man/man3/tqtextdecoder.3qt index 18aba782..4b00f11d 100644 --- a/doc/man/man3/tqtextdecoder.3qt +++ b/doc/man/man3/tqtextdecoder.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextDecoder 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextDecoder 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,31 +7,31 @@ .ad l .nh .SH NAME -QTextDecoder \- State-based decoder +TQTextDecoder \- State-based decoder .SH SYNOPSIS All the functions in this class are reentrant when TQt is built with thread support.

    .PP -\fC#include \fR +\fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "virtual \fB~QTextDecoder\fR ()" +.BI "virtual \fB~TQTextDecoder\fR ()" .br .ti -1c .BI "virtual TQString \fBtoUnicode\fR ( const char * chars, int len ) = 0" .br .in -1c .SH DESCRIPTION -The QTextDecoder class provides a state-based decoder. +The TQTextDecoder class provides a state-based decoder. .PP The decoder converts a text format into Unicode, remembering any state that is required between calls. .PP -See also QTextCodec::makeEncoder() and Internationalization with Qt. +See also TQTextCodec::makeEncoder() and Internationalization with Qt. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextDecoder::~QTextDecoder ()\fC [virtual]\fR" +.SH "TQTextDecoder::~TQTextDecoder ()\fC [virtual]\fR" Destroys the decoder. -.SH "TQString QTextDecoder::toUnicode ( const char * chars, int len )\fC [pure virtual]\fR" +.SH "TQString TQTextDecoder::toUnicode ( const char * chars, int len )\fC [pure virtual]\fR" Converts the first \fIlen\fR bytes in \fIchars\fR to Unicode, returning the result. .PP If not all characters are used (e.g. if only part of a multi-byte @@ -39,7 +39,7 @@ encoding is at the end of the characters), the decoder remembers enough state to continue with the next call to this function. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qtextdecoder.html +.BR http://doc.trolltech.com/tqtextdecoder.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextdrag.3qt b/doc/man/man3/tqtextdrag.3qt index 481fa59e..b4f90345 100644 --- a/doc/man/man3/tqtextdrag.3qt +++ b/doc/man/man3/tqtextdrag.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextDrag 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextDrag 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QTextDrag \- Drag and drop object for transferring plain and Unicode text +TQTextDrag \- Drag and drop object for transferring plain and Unicode text .SH SYNOPSIS \fC#include \fR .PP @@ -16,13 +16,13 @@ Inherits QDragObject. .SS "Public Members" .in +1c .ti -1c -.BI "\fBQTextDrag\fR ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 )" +.BI "\fBTQTextDrag\fR ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 )" .br .ti -1c -.BI "\fBQTextDrag\fR ( TQWidget * dragSource = 0, const char * name = 0 )" +.BI "\fBTQTextDrag\fR ( TQWidget * dragSource = 0, const char * name = 0 )" .br .ti -1c -.BI "\fB~QTextDrag\fR ()" +.BI "\fB~TQTextDrag\fR ()" .br .ti -1c .BI "virtual void \fBsetText\fR ( const TQString & text )" @@ -44,7 +44,7 @@ Inherits QDragObject. .br .in -1c .SH DESCRIPTION -The QTextDrag class is a drag and drop object for transferring plain and Unicode text. +The TQTextDrag class is a drag and drop object for transferring plain and Unicode text. .PP Plain text is passed in a TQString which may contain multiple lines (i.e. may contain newline characters). The drag target will receive the newlines according to the runtime environment, e.g. LF on Unix, and CRLF on Windows. .PP @@ -54,38 +54,38 @@ For more information about drag and drop, see the QDragObject class and the drag .PP See also Drag And Drop Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextDrag::QTextDrag ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 )" +.SH "TQTextDrag::TQTextDrag ( const TQString & text, TQWidget * dragSource = 0, const char * name = 0 )" Constructs a text drag object and sets its data to \fItext\fR. \fIdragSource\fR must be the drag source; \fIname\fR is the object name. -.SH "QTextDrag::QTextDrag ( TQWidget * dragSource = 0, const char * name = 0 )" +.SH "TQTextDrag::TQTextDrag ( TQWidget * dragSource = 0, const char * name = 0 )" Constructs a default text drag object. \fIdragSource\fR must be the drag source; \fIname\fR is the object name. -.SH "QTextDrag::~QTextDrag ()" +.SH "TQTextDrag::~TQTextDrag ()" Destroys the text drag object and frees up all allocated resources. -.SH "bool QTextDrag::canDecode ( const QMimeSource * e )\fC [static]\fR" +.SH "bool TQTextDrag::canDecode ( const QMimeSource * e )\fC [static]\fR" Returns TRUE if the information in \fIe\fR can be decoded into a TQString; otherwise returns FALSE. .PP See also decode(). .PP Example: iconview/simple_dd/main.cpp. -.SH "bool QTextDrag::decode ( const QMimeSource * e, TQString & str )\fC [static]\fR" +.SH "bool TQTextDrag::decode ( const QMimeSource * e, TQString & str )\fC [static]\fR" Attempts to decode the dropped information in \fIe\fR into \fIstr\fR. Returns TRUE if successful; otherwise returns FALSE. .PP See also canDecode(). .PP Example: iconview/simple_dd/main.cpp. -.SH "bool QTextDrag::decode ( const QMimeSource * e, TQString & str, QCString & subtype )\fC [static]\fR" +.SH "bool TQTextDrag::decode ( const QMimeSource * e, TQString & str, QCString & subtype )\fC [static]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Attempts to decode the dropped information in \fIe\fR into \fIstr\fR. Returns TRUE if successful; otherwise returns FALSE. If \fIsubtype\fR is null, any text subtype is accepted; otherwise only the specified \fIsubtype\fR is accepted. .PP See also canDecode(). -.SH "void QTextDrag::setSubtype ( const QCString & st )\fC [virtual]\fR" +.SH "void TQTextDrag::setSubtype ( const QCString & st )\fC [virtual]\fR" Sets the MIME subtype of the text being dragged to \fIst\fR. The default subtype is "plain", so the default MIME type of the text is "text/plain". You might use this to declare that the text is" text/html" by calling setSubtype("html"). -.SH "void QTextDrag::setText ( const TQString & text )\fC [virtual]\fR" +.SH "void TQTextDrag::setText ( const TQString & text )\fC [virtual]\fR" Sets the text to be dragged to \fItext\fR. You will need to call this if you did not pass the text during construction. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qtextdrag.html +.BR http://doc.trolltech.com/tqtextdrag.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextedit.3qt b/doc/man/man3/tqtextedit.3qt index 967de1cd..c6ffa2df 100644 --- a/doc/man/man3/tqtextedit.3qt +++ b/doc/man/man3/tqtextedit.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextEdit 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextEdit 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,13 +7,13 @@ .ad l .nh .SH NAME -QTextEdit \- Powerful single-page rich text editor +TQTextEdit \- Powerful single-page rich text editor .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QScrollView. .PP -Inherited by QMultiLineEdit, QTextBrowser, and QTextView. +Inherited by QMultiLineEdit, TQTextBrowser, and TQTextView. .PP .SS "Public Members" .in +1c @@ -36,10 +36,10 @@ Inherited by QMultiLineEdit, QTextBrowser, and QTextView. .BI "enum \fBVerticalAlignment\fR { AlignNormal, AlignSuperScript, AlignSubScript }" .br .ti -1c -.BI "\fBQTextEdit\fR ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQTextEdit\fR ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fBQTextEdit\fR ( TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQTextEdit\fR ( TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c .BI "TQString \fBtext\fR () const" @@ -327,7 +327,7 @@ Inherited by QMultiLineEdit, QTextBrowser, and QTextView. .BI "virtual void \fBensureCursorVisible\fR ()" .br .ti -1c -.BI "virtual void \fBplaceCursor\fR ( const QPoint & pos, QTextCursor * c = 0 )" +.BI "virtual void \fBplaceCursor\fR ( const QPoint & pos, TQTextCursor * c = 0 )" .br .ti -1c .BI "virtual void \fBmoveCursor\fR ( CursorAction action, bool select )" @@ -501,7 +501,7 @@ Inherited by QMultiLineEdit, QTextBrowser, and QTextView. .BI "virtual bool \fBfocusNextPrevChild\fR ( bool n )" .br .ti -1c -.BI "QTextCursor * \fBtextCursor\fR () const" +.BI "TQTextCursor * \fBtextCursor\fR () const" .br .ti -1c .BI "virtual QPopupMenu * \fBcreatePopupMenu\fR ( const QPoint & pos )" @@ -511,26 +511,26 @@ Inherited by QMultiLineEdit, QTextBrowser, and QTextView. .br .in -1c .SH DESCRIPTION -The QTextEdit widget provides a powerful single-page rich text editor. +The TQTextEdit widget provides a powerful single-page rich text editor. .PP .TP Introduction and Concepts .TP -Using QTextEdit as a Display Widget +Using TQTextEdit as a Display Widget .TP Read-only key bindings .TP -Using QTextEdit in LogText Mode +Using TQTextEdit in LogText Mode .TP -Using QTextEdit as an Editor +Using TQTextEdit as an Editor .TP Editing key bindings .SH "Introduction and Concepts" -QTextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags. It is optimized to handle large documents and to respond quickly to user input. +TQTextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags. It is optimized to handle large documents and to respond quickly to user input. .PP -QTextEdit has four modes of operation:
    .nf +TQTextEdit has four modes of operation:
    .nf .TS l - l. Mode Command Notes Plain Text Editor setTextFormat(PlainText) Set text with setText(); text() returns plain text. Text attributes (e.g. colors) can be set, but plain text is always returned. Rich Text Editor setTextFormat(RichText) Set text with setText(); text() returns rich text. Rich text editing is fairly limited. You can't set margins or insert images for example (although you can read and correctly display files that have margins set and that include images). This mode is mostly useful for editing small amounts of rich text. Text Viewer setReadOnly(TRUE) Set text with setText() or append() (which has no undo history so is faster and uses less memory); text() returns plain or rich text depending on the textFormat(). This mode can correctly display a large subset of HTML tags. Log Viewer setTextFormat(LogText) .TE @@ -539,11 +539,11 @@ l - l. Mode Command Notes Plain Text Editor setTextFormat(PlainText) Set text wi .PP 1.A more complete API that supports setting margins, images, etc., is planned for a later TQt release. .PP -QTextEdit can be used as a syntax highlighting editor when used in conjunction with QSyntaxHighlighter. +TQTextEdit can be used as a syntax highlighting editor when used in conjunction with QSyntaxHighlighter. .PP We recommend that you always call setTextFormat() to set the mode you want to use. If you use AutoText then setText() and append() will try to determine whether the text they are given is plain text or rich text. If you use RichText then setText() and append() will assume that the text they are given is rich text. insert() simply inserts the text it is given. .PP -QTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signify a paragraph. A document consists of zero or more paragraphs, indexed from 0. Characters are indexed on a per-paragraph basis, also indexed from 0. The words in the paragraph are aligned in accordance with the paragraph's alignment(). Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color. +TQTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signify a paragraph. A document consists of zero or more paragraphs, indexed from 0. Characters are indexed on a per-paragraph basis, also indexed from 0. The words in the paragraph are aligned in accordance with the paragraph's alignment(). Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color. .PP The text edit documentation uses the following concepts: .TP @@ -551,15 +551,15 @@ The text edit documentation uses the following concepts: .TP \fIcurrent paragraph\fR -- the paragraph which contains the cursor. .PP -QTextEdit can display images (using QMimeSourceFactory), lists and tables. If the text is too large to view within the text edit's viewport, scrollbars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4). The rendering style and the set of valid tags are defined by a styleSheet(). Custom tags can be created and placed in a custom style sheet. Change the style sheet with setStyleSheet(); see QStyleSheet for details. The images identified by image tags are displayed if they can be interpreted using the text edit's QMimeSourceFactory; see setMimeSourceFactory(). +TQTextEdit can display images (using QMimeSourceFactory), lists and tables. If the text is too large to view within the text edit's viewport, scrollbars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4). The rendering style and the set of valid tags are defined by a styleSheet(). Custom tags can be created and placed in a custom style sheet. Change the style sheet with setStyleSheet(); see QStyleSheet for details. The images identified by image tags are displayed if they can be interpreted using the text edit's QMimeSourceFactory; see setMimeSourceFactory(). .PP -If you want a text browser with more navigation use QTextBrowser. If you just need to display a small piece of rich text use QLabel or QSimpleRichText. +If you want a text browser with more navigation use TQTextBrowser. If you just need to display a small piece of rich text use QLabel or QSimpleRichText. .PP -If you create a new QTextEdit, and want to allow the user to edit rich text, call setTextFormat(TQt::RichText) to ensure that the text is treated as rich text. (Rich text uses HTML tags to set text formatting attributes. See QStyleSheet for information on the HTML tags that are supported.). If you don't call setTextFormat() explicitly the text edit will guess from the text itself whether it is rich text or plain text. This means that if the text looks like HTML or XML it will probably be interpreted as rich text, so you should call setTextFormat(TQt::PlainText) to preserve such text. +If you create a new TQTextEdit, and want to allow the user to edit rich text, call setTextFormat(TQt::RichText) to ensure that the text is treated as rich text. (Rich text uses HTML tags to set text formatting attributes. See QStyleSheet for information on the HTML tags that are supported.). If you don't call setTextFormat() explicitly the text edit will guess from the text itself whether it is rich text or plain text. This means that if the text looks like HTML or XML it will probably be interpreted as rich text, so you should call setTextFormat(TQt::PlainText) to preserve such text. .PP Note that we do not intend to add a full-featured web browser widget to TQt (because that would easily double Qt's size and only a few applications would benefit from it). The rich text support in TQt is designed to provide a fast, portable and efficient way to add reasonable online help facilities to applications, and to provide a basis for rich text editors. -.SH "Using QTextEdit as a Display Widget" -QTextEdit can display a large HTML subset, including tables and images. +.SH "Using TQTextEdit as a Display Widget" +TQTextEdit can display a large HTML subset, including tables and images. .PP The text is set or replaced using setText() which deletes any existing text and replaces it with the text passed in the setText() call. If you call setText() with legacy HTML (with setTextFormat(RichText) in force), and then call text(), the text that is returned may have different markup, but will render the same. Text can be inserted with insert(), paste(), pasteSubType() and append(). Text that is appended does not go into the undo history; this makes append() faster and consumes less memory. Text can also be cut(). The entire text is deleted with clear() and the selected text is deleted with removeSelectedText(). Selected (marked) text can also be deleted with del() (which will delete the character to the right of the cursor if no text is selected). .PP @@ -571,7 +571,7 @@ Loading and saving text is achieved using setText() and text(), for example: .br if ( file.open( IO_ReadOnly ) ) { .br - QTextStream stream( &file ); + TQTextStream stream( &file ); .br textEdit->setText( stream.read() ); .br @@ -582,7 +582,7 @@ Loading and saving text is achieved using setText() and text(), for example: .br if ( file.open( IO_WriteOnly ) ) { .br - QTextStream stream( &file ); + TQTextStream stream( &file ); .br stream << textEdit->text(); .br @@ -604,11 +604,11 @@ The lines() function returns the number of lines in the text and paragraphs() re .PP You can scroll to an anchor in the text, e.g. \fC\fR with scrollToAnchor(). The find() function can be used to find and select a given string within the text. .PP -A read-only QTextEdit provides the same functionality as the (obsolete) QTextView. (QTextView is still supplied for compatibility with old code.) +A read-only TQTextEdit provides the same functionality as the (obsolete) TQTextView. (TQTextView is still supplied for compatibility with old code.) .PP

    Read-only key bindings

    .PP -When QTextEdit is used read-only the key-bindings are limited to navigation, and text may only be selected with the mouse:
    .nf +When TQTextEdit is used read-only the key-bindings are limited to navigation, and text may only be selected with the mouse:
    .nf .TS l - l. Keypresses Action UpArrow Move one line up DownArrow Move one line down LeftArrow Move one character left RightArrow Move one character right PageUp Move one (viewport) page up PageDown Move one (viewport) page down Home Move to the beginning of the text End Move to the end of the text Shift+Wheel Scroll the page horizontally (the Wheel is the mouse wheel) Ctrl+Wheel .TE @@ -617,9 +617,9 @@ l - l. Keypresses Action UpArrow Move one line up DownArrow Move one line down L .PP The text edit may be able to provide some meta-information. For example, the documentTitle() function will return the text from within HTML \fC\fR tags. .PP -The text displayed in a text edit has a \fIcontext\fR. The context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. (See QTextEdit() and context().) +The text displayed in a text edit has a \fIcontext\fR. The context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. (See TQTextEdit() and context().) .PP -<h4> Using QTextEdit in LogText Mode </h4> +<h4> Using TQTextEdit in LogText Mode </h4> .PP Setting the text format to LogText puts the widget in a special mode which is optimized for very large texts. Editing, word wrap, and rich text support are disabled in this mode (the widget is explicitly made read-only). This allows the text to be stored in a different, more memory efficient manner. However, a certain degree of text formatting is supported through the use of formatting tags. A tag is delimited by \fC<\fR and \fC>\fR. The characters \fC<\fR, \fC>\fR and \fC&\fR are escaped by using \fC<\fR, \fC>\fR and \fC&\fR. A tag pair consists of a left and a right tag (or open/close tags). Left-tags mark the starting point for formatting, while right-tags mark the ending point. A right-tag always start with a \fC/\fR before the tag keyword. For example \fC<b>\fR and \fC</b>\fR are a tag pair. Tags can be nested, but they have to be closed in the same order as they are opened. For example, \fC<b><u></u></b>\fR is valid, while \fC<b><u></b></u>\fR will output an error message. .PP @@ -637,7 +637,7 @@ Stylesheets can also be used in LogText mode. To create and use a custom tag, yo .PP .nf .br - QTextEdit * log = new QTextEdit( this ); + TQTextEdit * log = new TQTextEdit( this ); .br log->setTextFormat( TQt::LogText ); .br @@ -661,18 +661,18 @@ There are a few things that you need to be aware of when the widget is in this m Functions that deal with rich text formatting and cursor movement will not work or return anything valid. .TP Lines are equivalent to paragraphs. -.SH "Using QTextEdit as an Editor" -All the information about using QTextEdit as a display widget also applies here. +.SH "Using TQTextEdit as an Editor" +All the information about using TQTextEdit as a display widget also applies here. .PP The current format's attributes are set with setItalic(), setBold(), setUnderline(), setFamily() (font family), setPointSize(), setColor() and setCurrentFont(). The current paragraph's alignment is set with setAlignment(). .PP -Use setSelection() to select text. The setSelectionAttributes() function is used to indicate how selected text should be displayed. Use hasSelectedText() to find out if any text is selected. The currently selected text's position is available using getSelection() and the selected text itself is returned by selectedText(). The selection can be copied to the clipboard with copy(), or cut to the clipboard with cut(). It can be deleted with removeSelectedText(). The entire text can be selected (or unselected) using selectAll(). QTextEdit supports multiple selections. Most of the selection functions operate on the default selection, selection 0. If the user presses a non-selecting key, e.g. a cursor key without also holding down Shift, all selections are cleared. +Use setSelection() to select text. The setSelectionAttributes() function is used to indicate how selected text should be displayed. Use hasSelectedText() to find out if any text is selected. The currently selected text's position is available using getSelection() and the selected text itself is returned by selectedText(). The selection can be copied to the clipboard with copy(), or cut to the clipboard with cut(). It can be deleted with removeSelectedText(). The entire text can be selected (or unselected) using selectAll(). TQTextEdit supports multiple selections. Most of the selection functions operate on the default selection, selection 0. If the user presses a non-selecting key, e.g. a cursor key without also holding down Shift, all selections are cleared. .PP Set and get the position of the cursor with setCursorPosition() and getCursorPosition() respectively. When the cursor is moved, the signals currentFontChanged(), currentColorChanged() and currentAlignmentChanged() are emitted to reflect the font, color and alignment at the new cursor position. .PP If the text changes, the textChanged() signal is emitted, and if the user inserts a new line by pressing Return or Enter, returnPressed() is emitted. The isModified() function will return TRUE if the text has been modified. .PP -QTextEdit provides command-based undo and redo. To set the depth of the command history use setUndoDepth() which defaults to 100 steps. To undo or redo the last operation call undo() or redo(). The signals undoAvailable() and redoAvailable() indicate whether the undo and redo operations can be executed. +TQTextEdit provides command-based undo and redo. To set the depth of the command history use setUndoDepth() which defaults to 100 steps. To undo or redo the last operation call undo() or redo(). The signals undoAvailable() and redoAvailable() indicate whether the undo and redo operations can be executed. .PP The indent() function is used to reindent a paragraph. It is useful for code editors, for example in TQt Designer's code editor \fICtrl+I\fR invokes the indent() function. .PP @@ -691,143 +691,143 @@ By default the text edit widget operates in insert mode so all text that the use .PP See also Basic Widgets and Text Related Classes. .SS "Member Type Documentation" -.SH "QTextEdit::AutoFormatting" +.SH "TQTextEdit::AutoFormatting" .TP -\fCQTextEdit::AutoNone\fR - Do not perform any automatic formatting +\fCTQTextEdit::AutoNone\fR - Do not perform any automatic formatting .TP -\fCQTextEdit::AutoBulletList\fR - Only automatically format bulletted lists +\fCTQTextEdit::AutoBulletList\fR - Only automatically format bulletted lists .TP -\fCQTextEdit::AutoAll\fR - Apply all available autoformatting -.SH "QTextEdit::CursorAction" +\fCTQTextEdit::AutoAll\fR - Apply all available autoformatting +.SH "TQTextEdit::CursorAction" This enum is used by moveCursor() to specify in which direction the cursor should be moved: .TP -\fCQTextEdit::MoveBackward\fR - Moves the cursor one character backward +\fCTQTextEdit::MoveBackward\fR - Moves the cursor one character backward .TP -\fCQTextEdit::MoveWordBackward\fR - Moves the cursor one word backward +\fCTQTextEdit::MoveWordBackward\fR - Moves the cursor one word backward .TP -\fCQTextEdit::MoveForward\fR - Moves the cursor one character forward +\fCTQTextEdit::MoveForward\fR - Moves the cursor one character forward .TP -\fCQTextEdit::MoveWordForward\fR - Moves the cursor one word forward +\fCTQTextEdit::MoveWordForward\fR - Moves the cursor one word forward .TP -\fCQTextEdit::MoveUp\fR - Moves the cursor up one line +\fCTQTextEdit::MoveUp\fR - Moves the cursor up one line .TP -\fCQTextEdit::MoveDown\fR - Moves the cursor down one line +\fCTQTextEdit::MoveDown\fR - Moves the cursor down one line .TP -\fCQTextEdit::MoveLineStart\fR - Moves the cursor to the beginning of the line +\fCTQTextEdit::MoveLineStart\fR - Moves the cursor to the beginning of the line .TP -\fCQTextEdit::MoveLineEnd\fR - Moves the cursor to the end of the line +\fCTQTextEdit::MoveLineEnd\fR - Moves the cursor to the end of the line .TP -\fCQTextEdit::MoveHome\fR - Moves the cursor to the beginning of the document +\fCTQTextEdit::MoveHome\fR - Moves the cursor to the beginning of the document .TP -\fCQTextEdit::MoveEnd\fR - Moves the cursor to the end of the document +\fCTQTextEdit::MoveEnd\fR - Moves the cursor to the end of the document .TP -\fCQTextEdit::MovePgUp\fR - Moves the cursor one viewport page up +\fCTQTextEdit::MovePgUp\fR - Moves the cursor one viewport page up .TP -\fCQTextEdit::MovePgDown\fR - Moves the cursor one viewport page down -.SH "QTextEdit::KeyboardAction" +\fCTQTextEdit::MovePgDown\fR - Moves the cursor one viewport page down +.SH "TQTextEdit::KeyboardAction" This enum is used by doKeyboardAction() to specify which action should be executed: .TP -\fCQTextEdit::ActionBackspace\fR - Delete the character to the left of the cursor. +\fCTQTextEdit::ActionBackspace\fR - Delete the character to the left of the cursor. .TP -\fCQTextEdit::ActionDelete\fR - Delete the character to the right of the cursor. +\fCTQTextEdit::ActionDelete\fR - Delete the character to the right of the cursor. .TP -\fCQTextEdit::ActionReturn\fR - Split the paragraph at the cursor position. +\fCTQTextEdit::ActionReturn\fR - Split the paragraph at the cursor position. .TP -\fCQTextEdit::ActionKill\fR - If the cursor is not at the end of the paragraph, delete the text from the cursor position until the end of the paragraph. If the cursor is at the end of the paragraph, delete the hard line break at the end of the paragraph: this will cause this paragraph to be joined with the following paragraph. +\fCTQTextEdit::ActionKill\fR - If the cursor is not at the end of the paragraph, delete the text from the cursor position until the end of the paragraph. If the cursor is at the end of the paragraph, delete the hard line break at the end of the paragraph: this will cause this paragraph to be joined with the following paragraph. .TP -\fCQTextEdit::ActionWordBackspace\fR - Delete the word to the left of the cursor position. +\fCTQTextEdit::ActionWordBackspace\fR - Delete the word to the left of the cursor position. .TP -\fCQTextEdit::ActionWordDelete\fR - Delete the word to the right of the cursor position -.SH "QTextEdit::VerticalAlignment" +\fCTQTextEdit::ActionWordDelete\fR - Delete the word to the right of the cursor position +.SH "TQTextEdit::VerticalAlignment" This enum is used to set the vertical alignment of the text. .TP -\fCQTextEdit::AlignNormal\fR - Normal alignment +\fCTQTextEdit::AlignNormal\fR - Normal alignment .TP -\fCQTextEdit::AlignSuperScript\fR - Superscript +\fCTQTextEdit::AlignSuperScript\fR - Superscript .TP -\fCQTextEdit::AlignSubScript\fR - Subscript -.SH "QTextEdit::WordWrap" -This enum defines the QTextEdit's word wrap modes. +\fCTQTextEdit::AlignSubScript\fR - Subscript +.SH "TQTextEdit::WordWrap" +This enum defines the TQTextEdit's word wrap modes. .TP -\fCQTextEdit::NoWrap\fR - Do not wrap the text. +\fCTQTextEdit::NoWrap\fR - Do not wrap the text. .TP -\fCQTextEdit::WidgetWidth\fR - Wrap the text at the current width of the widget (this is the default). Wrapping is at whitespace by default; this can be changed with setWrapPolicy(). +\fCTQTextEdit::WidgetWidth\fR - Wrap the text at the current width of the widget (this is the default). Wrapping is at whitespace by default; this can be changed with setWrapPolicy(). .TP -\fCQTextEdit::FixedPixelWidth\fR - Wrap the text at a fixed number of pixels from the widget's left side. The number of pixels is set with wrapColumnOrWidth(). +\fCTQTextEdit::FixedPixelWidth\fR - Wrap the text at a fixed number of pixels from the widget's left side. The number of pixels is set with wrapColumnOrWidth(). .TP -\fCQTextEdit::FixedColumnWidth\fR - Wrap the text at a fixed number of character columns from the widget's left side. The number of characters is set with wrapColumnOrWidth(). This is useful if you need formatted text that can also be displayed gracefully on devices with monospaced fonts, for example a standard VT100 terminal, where you might set wrapColumnOrWidth() to 80. +\fCTQTextEdit::FixedColumnWidth\fR - Wrap the text at a fixed number of character columns from the widget's left side. The number of characters is set with wrapColumnOrWidth(). This is useful if you need formatted text that can also be displayed gracefully on devices with monospaced fonts, for example a standard VT100 terminal, where you might set wrapColumnOrWidth() to 80. .PP See also wordWrap and wordWrap. -.SH "QTextEdit::WrapPolicy" +.SH "TQTextEdit::WrapPolicy" This enum defines where text can be wrapped in word wrap mode. .TP -\fCQTextEdit::AtWhiteSpace\fR - Don't use this deprecated value (it is a synonym for AtWordBoundary which you should use instead). +\fCTQTextEdit::AtWhiteSpace\fR - Don't use this deprecated value (it is a synonym for AtWordBoundary which you should use instead). .TP -\fCQTextEdit::Anywhere\fR - Break anywhere, including within words. +\fCTQTextEdit::Anywhere\fR - Break anywhere, including within words. .TP -\fCQTextEdit::AtWordBoundary\fR - Break lines at word boundaries, e.g. spaces or newlines +\fCTQTextEdit::AtWordBoundary\fR - Break lines at word boundaries, e.g. spaces or newlines .TP -\fCQTextEdit::AtWordOrDocumentBoundary\fR - Break lines at whitespace, e.g. spaces or newlines if possible. Break it anywhere otherwise. +\fCTQTextEdit::AtWordOrDocumentBoundary\fR - Break lines at whitespace, e.g. spaces or newlines if possible. Break it anywhere otherwise. .PP See also wrapPolicy. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextEdit::QTextEdit ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 )" -Constructs a QTextEdit called \fIname\fR, with parent \fIparent\fR. The text edit will display the text \fItext\fR using context \fIcontext\fR. +.SH "TQTextEdit::TQTextEdit ( const TQString & text, const TQString & context = TQString::null, TQWidget * parent = 0, const char * name = 0 )" +Constructs a TQTextEdit called \fIname\fR, with parent \fIparent\fR. The text edit will display the text \fItext\fR using context \fIcontext\fR. .PP The \fIcontext\fR is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. .PP For example if the text contains an image tag, \fC<img src="image.png">\fR, and the context is "path/to/look/in", the QMimeSourceFactory will try to load the image from" path/to/look/in/image.png". If the tag was \fC<img src="/image.png">\fR, the context will not be used (because QMimeSourceFactory recognizes that we have used an absolute path) and will try to load "/image.png". The context is applied in exactly the same way to \fIhrefs\fR, for example, \fC<a href="target.html">Target</a>\fR, would resolve to" path/to/look/in/target.html". -.SH "QTextEdit::QTextEdit ( TQWidget * parent = 0, const char * name = 0 )" -Constructs an empty QTextEdit called \fIname\fR, with parent \fIparent\fR. -.SH "int QTextEdit::alignment () const" +.SH "TQTextEdit::TQTextEdit ( TQWidget * parent = 0, const char * name = 0 )" +Constructs an empty TQTextEdit called \fIname\fR, with parent \fIparent\fR. +.SH "int TQTextEdit::alignment () const" Returns the alignment of the current paragraph. .PP See also setAlignment(). -.SH "TQString QTextEdit::anchorAt ( const QPoint & pos, AnchorAttribute attr )" +.SH "TQString TQTextEdit::anchorAt ( const QPoint & pos, AnchorAttribute attr )" If there is an anchor at position \fIpos\fR (in contents coordinates), the text for attribute \fIattr\fR is returned, otherwise TQString::null is returned. -.SH "TQString QTextEdit::anchorAt ( const QPoint & pos )" +.SH "TQString TQTextEdit::anchorAt ( const QPoint & pos )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP If there is an anchor at position \fIpos\fR (in contents coordinates), its \fChref\fR is returned, otherwise TQString::null is returned. -.SH "void QTextEdit::append ( const TQString & text )\fC [virtual slot]\fR" +.SH "void TQTextEdit::append ( const TQString & text )\fC [virtual slot]\fR" Appends a new paragraph with \fItext\fR to the end of the text edit. Note that the undo/redo history is cleared by this function, and no undo history is kept for appends which makes them faster than insert()s. If you want to append text which is added to the undo/redo history as well, use insertParagraph(). .PP Examples: .)l network/clientserver/client/client.cpp, network/clientserver/server/server.cpp, network/httpd/httpd.cpp, and process/process.cpp. -.SH "uint QTextEdit::autoFormatting () const" +.SH "uint TQTextEdit::autoFormatting () const" Returns the enabled set of auto formatting features. See the "autoFormatting" property for details. -.SH "bool QTextEdit::bold () const" +.SH "bool TQTextEdit::bold () const" Returns TRUE if the current format is bold; otherwise returns FALSE. .PP See also setBold(). -.SH "int QTextEdit::charAt ( const QPoint & pos, int * para ) const" +.SH "int TQTextEdit::charAt ( const QPoint & pos, int * para ) const" Returns the index of the character (relative to its paragraph) at position \fIpos\fR (in contents coordinates). If \fIpara\fR is not 0, \fI*para\fR is set to the character's paragraph. -.SH "void QTextEdit::clear ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::clear ()\fC [virtual slot]\fR" Deletes all the text in the text edit. .PP See also cut(), removeSelectedText(), and text. -.SH "void QTextEdit::clearParagraphBackground ( int para )\fC [virtual slot]\fR" +.SH "void TQTextEdit::clearParagraphBackground ( int para )\fC [virtual slot]\fR" Clears the background color of the paragraph \fIpara\fR, so that the default color is used again. -.SH "void QTextEdit::clicked ( int para, int pos )\fC [signal]\fR" +.SH "void TQTextEdit::clicked ( int para, int pos )\fC [signal]\fR" This signal is emitted when the mouse is clicked on the paragraph \fIpara\fR at character position \fIpos\fR. .PP See also doubleClicked(). -.SH "TQColor QTextEdit::color () const" +.SH "TQColor TQTextEdit::color () const" Returns the color of the current format. .PP See also setColor() and paper. -.SH "TQString QTextEdit::context () const" +.SH "TQString TQTextEdit::context () const" Returns the context of the text edit. The context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. .PP See also text. .PP Examples: .)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp. -.SH "void QTextEdit::copy ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::copy ()\fC [virtual slot]\fR" Copies any selected text (from selection 0) to the clipboard. .PP See also hasSelectedText and copyAvailable(). -.SH "void QTextEdit::copyAvailable ( bool yes )\fC [signal]\fR" +.SH "void TQTextEdit::copyAvailable ( bool yes )\fC [signal]\fR" This signal is emitted when text is selected or de-selected in the text edit. .PP When text is selected this signal will be emitted with \fIyes\fR set to TRUE. If no text has been selected or if the selected text is de-selected this signal is emitted with \fIyes\fR set to FALSE. @@ -835,11 +835,11 @@ When text is selected this signal will be emitted with \fIyes\fR set to TRUE. If If \fIyes\fR is TRUE then copy() can be used to copy the selection to the clipboard. If \fIyes\fR is FALSE then copy() does nothing. .PP See also selectionChanged(). -.SH "QPopupMenu * QTextEdit::createPopupMenu ( const QPoint & pos )\fC [virtual protected]\fR" +.SH "QPopupMenu * TQTextEdit::createPopupMenu ( const QPoint & pos )\fC [virtual protected]\fR" This function is called to create a right mouse button popup menu at the document position \fIpos\fR. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller. .PP \fBWarning:\fR The QPopupMenu ID values 0-7 are reserved, and they map to the standard operations. When inserting items into your custom popup menu, be sure to specify ID values larger than 7. -.SH "QPopupMenu * QTextEdit::createPopupMenu ()\fC [virtual protected]\fR" +.SH "QPopupMenu * TQTextEdit::createPopupMenu ()\fC [virtual protected]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. @@ -847,65 +847,65 @@ This is an overloaded member function, provided for convenience. It behaves esse This function is called to create a right mouse button popup menu. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller. .PP This function is only called if createPopupMenu( const QPoint & ) returns 0. -.SH "void QTextEdit::currentAlignmentChanged ( int a )\fC [signal]\fR" +.SH "void TQTextEdit::currentAlignmentChanged ( int a )\fC [signal]\fR" This signal is emitted if the alignment of the current paragraph has changed. .PP The new alignment is \fIa\fR. .PP See also setAlignment(). -.SH "void QTextEdit::currentColorChanged ( const TQColor & c )\fC [signal]\fR" +.SH "void TQTextEdit::currentColorChanged ( const TQColor & c )\fC [signal]\fR" This signal is emitted if the color of the current format has changed. .PP The new color is \fIc\fR. .PP See also setColor(). -.SH "QFont QTextEdit::currentFont () const" +.SH "QFont TQTextEdit::currentFont () const" Returns the font of the current format. .PP See also setCurrentFont(), setFamily(), and setPointSize(). -.SH "void QTextEdit::currentFontChanged ( const QFont & f )\fC [signal]\fR" +.SH "void TQTextEdit::currentFontChanged ( const QFont & f )\fC [signal]\fR" This signal is emitted if the font of the current format has changed. .PP The new font is \fIf\fR. .PP See also setCurrentFont(). -.SH "void QTextEdit::currentVerticalAlignmentChanged ( VerticalAlignment a )\fC [signal]\fR" +.SH "void TQTextEdit::currentVerticalAlignmentChanged ( VerticalAlignment a )\fC [signal]\fR" This signal is emitted if the vertical alignment of the current format has changed. .PP The new vertical alignment is \fIa\fR. .PP See also setVerticalAlignment(). -.SH "void QTextEdit::cursorPositionChanged ( int para, int pos )\fC [signal]\fR" +.SH "void TQTextEdit::cursorPositionChanged ( int para, int pos )\fC [signal]\fR" This signal is emitted if the position of the cursor has changed. \fIpara\fR contains the paragraph index and \fIpos\fR contains the character position within the paragraph. .PP See also setCursorPosition(). -.SH "void QTextEdit::cut ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::cut ()\fC [virtual slot]\fR" Copies the selected text (from selection 0) to the clipboard and deletes it from the text edit. .PP If there is no selected text (in selection 0) nothing happens. .PP -See also QTextEdit::copy(), paste(), and pasteSubType(). -.SH "void QTextEdit::del ()\fC [virtual slot]\fR" +See also TQTextEdit::copy(), paste(), and pasteSubType(). +.SH "void TQTextEdit::del ()\fC [virtual slot]\fR" If there is some selected text (in selection 0) it is deleted. If there is no selected text (in selection 0) the character to the right of the text cursor is deleted. .PP See also removeSelectedText() and cut(). -.SH "void QTextEdit::doKeyboardAction ( KeyboardAction action )\fC [virtual slot]\fR" +.SH "void TQTextEdit::doKeyboardAction ( KeyboardAction action )\fC [virtual slot]\fR" Executes keyboard action \fIaction\fR. This is normally called by a key event handler. -.SH "TQString QTextEdit::documentTitle () const" +.SH "TQString TQTextEdit::documentTitle () const" Returns the title of the document parsed from the text. See the "documentTitle" property for details. -.SH "void QTextEdit::doubleClicked ( int para, int pos )\fC [signal]\fR" +.SH "void TQTextEdit::doubleClicked ( int para, int pos )\fC [signal]\fR" This signal is emitted when the mouse is double-clicked on the paragraph \fIpara\fR at character position \fIpos\fR. .PP See also clicked(). -.SH "void QTextEdit::ensureCursorVisible ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::ensureCursorVisible ()\fC [virtual slot]\fR" Ensures that the cursor is visible by scrolling the text edit if necessary. .PP See also setCursorPosition(). -.SH "TQString QTextEdit::family () const" +.SH "TQString TQTextEdit::family () const" Returns the font family of the current format. .PP See also setFamily(), setCurrentFont(), and setPointSize(). -.SH "bool QTextEdit::find ( const TQString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )\fC [virtual]\fR" +.SH "bool TQTextEdit::find ( const TQString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )\fC [virtual]\fR" Finds the next occurrence of the string, \fIexpr\fR. Returns TRUE if \fIexpr\fR was found; otherwise returns FALSE. .PP If \fIpara\fR and \fIindex\fR are both 0 the search begins from the current cursor position. If \fIpara\fR and \fIindex\fR are both not 0, the search begins from the \fI*index\fR character position in the \fI*para\fR paragraph. @@ -919,9 +919,9 @@ If \fIexpr\fR is not found the function returns FALSE. If \fIindex\fR and \fIpar Please note that this function will make the next occurrence of the string (if found) the current selection, and will thus modify the cursor position. .PP Using the \fIpara\fR and \fIindex\fR parameters will not work correctly in case the document contains tables. -.SH "bool QTextEdit::focusNextPrevChild ( bool n )\fC [virtual protected]\fR" +.SH "bool TQTextEdit::focusNextPrevChild ( bool n )\fC [virtual protected]\fR" Reimplemented to allow tabbing through links. If \fIn\fR is TRUE the tab moves the focus to the next child; if \fIn\fR is FALSE the tab moves the focus to the previous child. Returns TRUE if the focus was moved; otherwise returns FALSE. -.SH "QFont QTextEdit::font () const" +.SH "QFont TQTextEdit::font () const" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP Returns QScrollView::font() @@ -929,11 +929,11 @@ Returns QScrollView::font() \fBWarning:\fR In previous versions this function returned the font of the current format. This lead to confusion. Please use currentFont() instead. .PP Example: qwerty/qwerty.cpp. -.SH "void QTextEdit::getCursorPosition ( int * para, int * index ) const" +.SH "void TQTextEdit::getCursorPosition ( int * para, int * index ) const" This function sets the \fI*para\fR and \fI*index\fR parameters to the current cursor position. \fIpara\fR and \fIindex\fR must not be 0. .PP See also setCursorPosition(). -.SH "void QTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const" +.SH "void TQTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const" If there is a selection, \fI*paraFrom\fR is set to the number of the paragraph in which the selection begins and \fI*paraTo\fR is set to the number of the paragraph in which the selection ends. (They could be the same.) \fI*indexFrom\fR is set to the index at which the selection begins within \fI*paraFrom\fR, and \fI*indexTo\fR is set to the index at which the selection ends within \fI*paraTo\fR. .PP If there is no selection, \fI*paraFrom\fR, \fI*indexFrom\fR, \fI*paraTo\fR and \fI*indexTo\fR are all set to -1. @@ -943,210 +943,210 @@ If \fIparaFrom\fR, \fIindexFrom\fR, \fIparaTo\fR or \fIindexTo\fR is 0 this func The \fIselNum\fR is the number of the selection (multiple selections are supported). It defaults to 0 (the default selection). .PP See also setSelection() and selectedText. -.SH "bool QTextEdit::hasSelectedText () const" +.SH "bool TQTextEdit::hasSelectedText () const" Returns TRUE if some text is selected in selection 0; otherwise returns FALSE. See the "hasSelectedText" property for details. -.SH "int QTextEdit::heightForWidth ( int w ) const\fC [virtual]\fR" +.SH "int TQTextEdit::heightForWidth ( int w ) const\fC [virtual]\fR" Returns how many pixels high the text edit needs to be to display all the text if the text edit is \fIw\fR pixels wide. .PP Reimplemented from TQWidget. -.SH "void QTextEdit::insert ( const TQString & text, uint insertionFlags = CheckNewLines | RemoveSelected )\fC [slot]\fR" +.SH "void TQTextEdit::insert ( const TQString & text, uint insertionFlags = CheckNewLines | RemoveSelected )\fC [slot]\fR" Inserts \fItext\fR at the current cursor position. .PP -The \fIinsertionFlags\fR define how the text is inserted. If RedoIndentation is set, the paragraph is re-indented. If CheckNewLines is set, newline characters in \fItext\fR result in hard line breaks (i.e. new paragraphs). If \fCcheckNewLine\fR is not set, the behaviour of the editor is undefined if the \fItext\fR contains newlines. (It is not possible to change QTextEdit's newline handling behavior, but you can use TQString::replace() to preprocess text before inserting it.) If RemoveSelected is set, any selected text (in selection 0) is removed before the text is inserted. +The \fIinsertionFlags\fR define how the text is inserted. If RedoIndentation is set, the paragraph is re-indented. If CheckNewLines is set, newline characters in \fItext\fR result in hard line breaks (i.e. new paragraphs). If \fCcheckNewLine\fR is not set, the behaviour of the editor is undefined if the \fItext\fR contains newlines. (It is not possible to change TQTextEdit's newline handling behavior, but you can use TQString::replace() to preprocess text before inserting it.) If RemoveSelected is set, any selected text (in selection 0) is removed before the text is inserted. .PP The default flags are CheckNewLines | RemoveSelected. .PP If the widget is in LogText mode this function will do nothing. .PP See also paste() and pasteSubType(). -.SH "void QTextEdit::insert ( const TQString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE )\fC [virtual slot]\fR" +.SH "void TQTextEdit::insert ( const TQString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE )\fC [virtual slot]\fR" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. -.SH "void QTextEdit::insertAt ( const TQString & text, int para, int index )\fC [virtual slot]\fR" +.SH "void TQTextEdit::insertAt ( const TQString & text, int para, int index )\fC [virtual slot]\fR" Inserts \fItext\fR in the paragraph \fIpara\fR at position \fIindex\fR. -.SH "void QTextEdit::insertParagraph ( const TQString & text, int para )\fC [virtual slot]\fR" +.SH "void TQTextEdit::insertParagraph ( const TQString & text, int para )\fC [virtual slot]\fR" Inserts \fItext\fR as a new paragraph at position \fIpara\fR. If \fIpara\fR is -1, the text is appended. Use append() if the append operation is performance critical. -.SH "bool QTextEdit::isModified () const" +.SH "bool TQTextEdit::isModified () const" Returns TRUE if the document has been modified by the user; otherwise returns FALSE. See the "modified" property for details. -.SH "bool QTextEdit::isOverwriteMode () const" +.SH "bool TQTextEdit::isOverwriteMode () const" Returns the text edit's overwrite mode. See the "overwriteMode" property for details. -.SH "bool QTextEdit::isReadOnly () const" +.SH "bool TQTextEdit::isReadOnly () const" Returns TRUE if the text edit is read-only; otherwise returns FALSE. See the "readOnly" property for details. -.SH "bool QTextEdit::isRedoAvailable () const" +.SH "bool TQTextEdit::isRedoAvailable () const" Returns TRUE if redo is available; otherwise returns FALSE. -.SH "bool QTextEdit::isUndoAvailable () const" +.SH "bool TQTextEdit::isUndoAvailable () const" Returns TRUE if undo is available; otherwise returns FALSE. -.SH "bool QTextEdit::isUndoRedoEnabled () const" +.SH "bool TQTextEdit::isUndoRedoEnabled () const" Returns TRUE if undo/redo is enabled; otherwise returns FALSE. See the "undoRedoEnabled" property for details. -.SH "bool QTextEdit::italic () const" +.SH "bool TQTextEdit::italic () const" Returns TRUE if the current format is italic; otherwise returns FALSE. .PP See also setItalic(). -.SH "void QTextEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR" +.SH "void TQTextEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR" Processes the key event, \fIe\fR. By default key events are used to provide keyboard navigation and text editing. .PP Reimplemented from TQWidget. .PP -Reimplemented in QTextBrowser. -.SH "int QTextEdit::length () const" +Reimplemented in TQTextBrowser. +.SH "int TQTextEdit::length () const" Returns the number of characters in the text. See the "length" property for details. -.SH "int QTextEdit::lineOfChar ( int para, int index )" +.SH "int TQTextEdit::lineOfChar ( int para, int index )" Returns the line number of the line in paragraph \fIpara\fR in which the character at position \fIindex\fR appears. The \fIindex\fR position is relative to the beginning of the paragraph. If there is no such paragraph or no such character at the \fIindex\fR position (e.g. the index is out of range) -1 is returned. -.SH "int QTextEdit::lines () const" +.SH "int TQTextEdit::lines () const" Returns the number of lines in the text edit; this could be 0. .PP \fBWarning:\fR This function may be slow. Lines change all the time during word wrapping, so this function has to iterate over all the paragraphs and get the number of lines from each one individually. -.SH "int QTextEdit::linesOfParagraph ( int para ) const" +.SH "int TQTextEdit::linesOfParagraph ( int para ) const" Returns the number of lines in paragraph \fIpara\fR, or -1 if there is no paragraph with index \fIpara\fR. -.SH "bool QTextEdit::linkUnderline () const" +.SH "bool TQTextEdit::linkUnderline () const" Returns TRUE if hypertext links will be underlined; otherwise returns FALSE. See the "linkUnderline" property for details. -.SH "int QTextEdit::maxLogLines ()\fC [slot]\fR" -Returns the maximum number of lines QTextEdit can hold in LogText mode. By default the number of lines is unlimited, which is signified by a value of -1. -.SH "QMimeSourceFactory * QTextEdit::mimeSourceFactory () const" +.SH "int TQTextEdit::maxLogLines ()\fC [slot]\fR" +Returns the maximum number of lines TQTextEdit can hold in LogText mode. By default the number of lines is unlimited, which is signified by a value of -1. +.SH "QMimeSourceFactory * TQTextEdit::mimeSourceFactory () const" Returns the QMimeSourceFactory which is being used by this text edit. .PP See also setMimeSourceFactory(). .PP Examples: .)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp. -.SH "void QTextEdit::modificationChanged ( bool m )\fC [signal]\fR" +.SH "void TQTextEdit::modificationChanged ( bool m )\fC [signal]\fR" This signal is emitted when the modification status of the document has changed. If \fIm\fR is TRUE, the document was modified, otherwise the modification state has been reset to unmodified. .PP See also modified. -.SH "void QTextEdit::moveCursor ( CursorAction action, bool select )\fC [virtual slot]\fR" +.SH "void TQTextEdit::moveCursor ( CursorAction action, bool select )\fC [virtual slot]\fR" Moves the text cursor according to \fIaction\fR. This is normally used by some key event handler. \fIselect\fR specifies whether the text between the current cursor position and the new position should be selected. -.SH "QBrush QTextEdit::paper () const" +.SH "QBrush TQTextEdit::paper () const" Returns the background (paper) brush. See the "paper" property for details. -.SH "int QTextEdit::paragraphAt ( const QPoint & pos ) const" +.SH "int TQTextEdit::paragraphAt ( const QPoint & pos ) const" Returns the paragraph which is at position \fIpos\fR (in contents coordinates). -.SH "TQColor QTextEdit::paragraphBackgroundColor ( int para ) const" +.SH "TQColor TQTextEdit::paragraphBackgroundColor ( int para ) const" Returns the background color of the paragraph \fIpara\fR or an invalid color if \fIpara\fR is out of range or the paragraph has no background set -.SH "int QTextEdit::paragraphLength ( int para ) const" +.SH "int TQTextEdit::paragraphLength ( int para ) const" Returns the length of the paragraph \fIpara\fR (i.e. the number of characters), or -1 if there is no paragraph with index \fIpara\fR. .PP This function ignores newlines. -.SH "QRect QTextEdit::paragraphRect ( int para ) const" +.SH "QRect TQTextEdit::paragraphRect ( int para ) const" Returns the rectangle of the paragraph \fIpara\fR in contents coordinates, or an invalid rectangle if \fIpara\fR is out of range. -.SH "int QTextEdit::paragraphs () const" +.SH "int TQTextEdit::paragraphs () const" Returns the number of paragraphs in the text; an empty textedit is always considered to have one paragraph, so 1 is returned in this case. -.SH "void QTextEdit::paste ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::paste ()\fC [virtual slot]\fR" Pastes the text from the clipboard into the text edit at the current cursor position. Only plain text is pasted. .PP If there is no text in the clipboard nothing happens. .PP -See also pasteSubType(), cut(), and QTextEdit::copy(). -.SH "void QTextEdit::pasteSubType ( const QCString & subtype )\fC [virtual slot]\fR" +See also pasteSubType(), cut(), and TQTextEdit::copy(). +.SH "void TQTextEdit::pasteSubType ( const QCString & subtype )\fC [virtual slot]\fR" Pastes the text with format \fIsubtype\fR from the clipboard into the text edit at the current cursor position. The \fIsubtype\fR can be" plain" or "html". .PP If there is no text with format \fIsubtype\fR in the clipboard nothing happens. .PP -See also paste(), cut(), and QTextEdit::copy(). -.SH "void QTextEdit::placeCursor ( const QPoint & pos, QTextCursor * c = 0 )\fC [virtual slot]\fR" +See also paste(), cut(), and TQTextEdit::copy(). +.SH "void TQTextEdit::placeCursor ( const QPoint & pos, TQTextCursor * c = 0 )\fC [virtual slot]\fR" Places the cursor \fIc\fR at the character which is closest to position \fIpos\fR (in contents coordinates). If \fIc\fR is 0, the default text cursor is used. .PP See also setCursorPosition(). -.SH "int QTextEdit::pointSize () const" +.SH "int TQTextEdit::pointSize () const" Returns the point size of the font of the current format. .PP See also setFamily(), setCurrentFont(), and setPointSize(). -.SH "void QTextEdit::redo ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::redo ()\fC [virtual slot]\fR" Redoes the last operation. .PP If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens. .PP See also redoAvailable(), undo(), and undoDepth. -.SH "void QTextEdit::redoAvailable ( bool yes )\fC [signal]\fR" +.SH "void TQTextEdit::redoAvailable ( bool yes )\fC [signal]\fR" This signal is emitted when the availability of redo changes. If \fIyes\fR is TRUE, then redo() will work until redoAvailable( FALSE ) is next emitted. .PP See also redo() and undoDepth. -.SH "void QTextEdit::removeParagraph ( int para )\fC [virtual slot]\fR" +.SH "void TQTextEdit::removeParagraph ( int para )\fC [virtual slot]\fR" Removes the paragraph \fIpara\fR. -.SH "void QTextEdit::removeSelectedText ( int selNum = 0 )\fC [virtual slot]\fR" +.SH "void TQTextEdit::removeSelectedText ( int selNum = 0 )\fC [virtual slot]\fR" Deletes the text of selection \fIselNum\fR (by default, the default selection, 0). If there is no selected text nothing happens. .PP See also selectedText and removeSelection(). -.SH "void QTextEdit::removeSelection ( int selNum = 0 )\fC [virtual slot]\fR" +.SH "void TQTextEdit::removeSelection ( int selNum = 0 )\fC [virtual slot]\fR" Removes the selection \fIselNum\fR (by default 0). This does not remove the selected text. .PP See also removeSelectedText(). -.SH "void QTextEdit::repaintChanged ()\fC [protected]\fR" +.SH "void TQTextEdit::repaintChanged ()\fC [protected]\fR" Repaints any paragraphs that have changed. .PP Although used extensively internally you shouldn't need to call this yourself. -.SH "void QTextEdit::returnPressed ()\fC [signal]\fR" +.SH "void TQTextEdit::returnPressed ()\fC [signal]\fR" This signal is emitted if the user pressed the Return or the Enter key. -.SH "void QTextEdit::scrollToAnchor ( const TQString & name )\fC [virtual slot]\fR" +.SH "void TQTextEdit::scrollToAnchor ( const TQString & name )\fC [virtual slot]\fR" Scrolls the text edit to make the text at the anchor called \fIname\fR visible, if it can be found in the document. If the anchor isn't found no scrolling will occur. An anchor is defined using the HTML anchor tag, e.g. \fC<a name="target">\fR. -.SH "void QTextEdit::scrollToBottom ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::scrollToBottom ()\fC [virtual slot]\fR" Scrolls to the bottom of the document and does formatting if required. -.SH "void QTextEdit::selectAll ( bool select = TRUE )\fC [virtual slot]\fR" +.SH "void TQTextEdit::selectAll ( bool select = TRUE )\fC [virtual slot]\fR" If \fIselect\fR is TRUE (the default), all the text is selected as selection 0. If \fIselect\fR is FALSE any selected text is unselected, i.e. the default selection (selection 0) is cleared. .PP See also selectedText. -.SH "TQString QTextEdit::selectedText () const" +.SH "TQString TQTextEdit::selectedText () const" Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). See the "selectedText" property for details. -.SH "void QTextEdit::selectionChanged ()\fC [signal]\fR" +.SH "void TQTextEdit::selectionChanged ()\fC [signal]\fR" This signal is emitted whenever the selection changes. .PP See also setSelection() and copyAvailable(). -.SH "void QTextEdit::setAlignment ( int a )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setAlignment ( int a )\fC [virtual slot]\fR" Sets the alignment of the current paragraph to \fIa\fR. Valid alignments are TQt::AlignLeft, TQt::AlignRight, TQt::AlignJustify and TQt::AlignCenter (which centers horizontally). .PP Reimplemented in QMultiLineEdit. -.SH "void QTextEdit::setAutoFormatting ( uint features )" +.SH "void TQTextEdit::setAutoFormatting ( uint features )" Sets the enabled set of auto formatting features to \fIfeatures\fR. See the "autoFormatting" property for details. -.SH "void QTextEdit::setBold ( bool b )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setBold ( bool b )\fC [virtual slot]\fR" If \fIb\fR is TRUE sets the current format to bold; otherwise sets the current format to non-bold. .PP See also bold(). -.SH "void QTextEdit::setColor ( const TQColor & c )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setColor ( const TQColor & c )\fC [virtual slot]\fR" Sets the color of the current format, i.e. of the text, to \fIc\fR. .PP See also color() and paper. -.SH "void QTextEdit::setCurrentFont ( const QFont & f )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setCurrentFont ( const QFont & f )\fC [virtual slot]\fR" Sets the font of the current format to \fIf\fR. .PP If the widget is in LogText mode this function will do nothing. Use setFont() instead. .PP See also currentFont(), setPointSize(), and setFamily(). -.SH "void QTextEdit::setCursorPosition ( int para, int index )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setCursorPosition ( int para, int index )\fC [virtual slot]\fR" Sets the cursor to position \fIindex\fR in paragraph \fIpara\fR. .PP See also getCursorPosition(). -.SH "void QTextEdit::setFamily ( const TQString & fontFamily )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setFamily ( const TQString & fontFamily )\fC [virtual slot]\fR" Sets the font family of the current format to \fIfontFamily\fR. .PP See also family() and setCurrentFont(). -.SH "void QTextEdit::setItalic ( bool b )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setItalic ( bool b )\fC [virtual slot]\fR" If \fIb\fR is TRUE sets the current format to italic; otherwise sets the current format to non-italic. .PP See also italic(). -.SH "void QTextEdit::setLinkUnderline ( bool )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setLinkUnderline ( bool )\fC [virtual slot]\fR" Sets whether hypertext links will be underlined. See the "linkUnderline" property for details. -.SH "void QTextEdit::setMaxLogLines ( int limit )\fC [slot]\fR" -Sets the maximum number of lines a QTextEdit can hold in LogText mode to \fIlimit\fR. If \fIlimit\fR is -1 (the default), this signifies an unlimited number of lines. +.SH "void TQTextEdit::setMaxLogLines ( int limit )\fC [slot]\fR" +Sets the maximum number of lines a TQTextEdit can hold in LogText mode to \fIlimit\fR. If \fIlimit\fR is -1 (the default), this signifies an unlimited number of lines. .PP \fBWarning:\fR Never use formatting tags that span more than one line when the maximum log lines is set. When lines are removed from the top of the buffer it could result in an unbalanced tag pair, i.e. the left formatting tag is removed before the right one. -.SH "void QTextEdit::setMimeSourceFactory ( QMimeSourceFactory * factory )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setMimeSourceFactory ( QMimeSourceFactory * factory )\fC [virtual slot]\fR" Sets the text edit's mimesource factory to \fIfactory\fR. See QMimeSourceFactory for further details. .PP See also mimeSourceFactory(). -.SH "void QTextEdit::setModified ( bool m )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setModified ( bool m )\fC [virtual slot]\fR" Sets whether the document has been modified by the user to \fIm\fR. See the "modified" property for details. -.SH "void QTextEdit::setOverwriteMode ( bool b )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setOverwriteMode ( bool b )\fC [virtual slot]\fR" Sets the text edit's overwrite mode to \fIb\fR. See the "overwriteMode" property for details. -.SH "void QTextEdit::setPaper ( const QBrush & pap )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setPaper ( const QBrush & pap )\fC [virtual slot]\fR" Sets the background (paper) brush to \fIpap\fR. See the "paper" property for details. -.SH "void QTextEdit::setParagraphBackgroundColor ( int para, const TQColor & bg )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setParagraphBackgroundColor ( int para, const TQColor & bg )\fC [virtual slot]\fR" Sets the background color of the paragraph \fIpara\fR to \fIbg\fR. -.SH "void QTextEdit::setPointSize ( int s )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setPointSize ( int s )\fC [virtual slot]\fR" Sets the point size of the current format to \fIs\fR. .PP Note that if \fIs\fR is zero or negative, the behaviour of this function is not defined. .PP See also pointSize(), setCurrentFont(), and setFamily(). -.SH "void QTextEdit::setReadOnly ( bool b )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setReadOnly ( bool b )\fC [virtual slot]\fR" Sets whether the text edit is read-only to \fIb\fR. See the "readOnly" property for details. -.SH "void QTextEdit::setSelection ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setSelection ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )\fC [virtual slot]\fR" Sets a selection which starts at position \fIindexFrom\fR in paragraph \fIparaFrom\fR and ends at position \fIindexTo\fR in paragraph \fIparaTo\fR. .PP Any existing selections which have a different id (\fIselNum\fR) are left alone, but if an existing selection has the same id as \fIselNum\fR it is removed and replaced by this selection. @@ -1156,21 +1156,21 @@ Uses the selection settings of selection \fIselNum\fR. If \fIselNum\fR is 0, thi The cursor is moved to the end of the selection if \fIselNum\fR is 0, otherwise the cursor position remains unchanged. .PP See also getSelection() and selectedText. -.SH "void QTextEdit::setSelectionAttributes ( int selNum, const TQColor & back, bool invertText )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setSelectionAttributes ( int selNum, const TQColor & back, bool invertText )\fC [virtual slot]\fR" Sets the background color of selection number \fIselNum\fR to \fIback\fR and specifies whether the text of this selection should be inverted with \fIinvertText\fR. .PP This only works for \fIselNum\fR > 0. The default selection (\fIselNum\fR == 0) gets its attributes from the text edit's colorGroup(). -.SH "void QTextEdit::setStyleSheet ( QStyleSheet * styleSheet )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setStyleSheet ( QStyleSheet * styleSheet )\fC [virtual slot]\fR" Sets the stylesheet to use with this text edit to \fIstyleSheet\fR. Changes will only take effect for new text added with setText() or append(). .PP See also styleSheet(). -.SH "void QTextEdit::setTabChangesFocus ( bool b )\fC [slot]\fR" +.SH "void TQTextEdit::setTabChangesFocus ( bool b )\fC [slot]\fR" Sets whether TAB changes focus or is accepted as input to \fIb\fR. See the "tabChangesFocus" property for details. -.SH "void QTextEdit::setTabStopWidth ( int ts )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setTabStopWidth ( int ts )\fC [virtual slot]\fR" Sets the tab stop width in pixels to \fIts\fR. See the "tabStopWidth" property for details. -.SH "void QTextEdit::setText ( const TQString & txt )\fC [slot]\fR" +.SH "void TQTextEdit::setText ( const TQString & txt )\fC [slot]\fR" Sets the text edit's text to \fItxt\fR. See the "text" property for details. -.SH "void QTextEdit::setText ( const TQString & text, const TQString & context )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setText ( const TQString & text, const TQString & context )\fC [virtual slot]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Changes the text of the text edit to the string \fItext\fR and the context to \fIcontext\fR. Any previous text is removed. @@ -1179,112 +1179,112 @@ Changes the text of the text edit to the string \fItext\fR and the context to \f .PP For rich text the rendering style and available tags are defined by a styleSheet(); see QStyleSheet for details. .PP -The optional \fIcontext\fR is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. (See QTextEdit::QTextEdit().) It is passed to the text edit's QMimeSourceFactory when quering data. +The optional \fIcontext\fR is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. (See TQTextEdit::TQTextEdit().) It is passed to the text edit's QMimeSourceFactory when quering data. .PP Note that the undo/redo history is cleared by this function. .PP See also text and textFormat. -.SH "void QTextEdit::setTextFormat ( TextFormat f )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setTextFormat ( TextFormat f )\fC [virtual slot]\fR" Sets the text format: rich text, plain text, log text or auto text to \fIf\fR. See the "textFormat" property for details. -.SH "void QTextEdit::setUnderline ( bool b )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setUnderline ( bool b )\fC [virtual slot]\fR" If \fIb\fR is TRUE sets the current format to underline; otherwise sets the current format to non-underline. .PP See also underline(). -.SH "void QTextEdit::setUndoDepth ( int d )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setUndoDepth ( int d )\fC [virtual slot]\fR" Sets the depth of the undo history to \fId\fR. See the "undoDepth" property for details. -.SH "void QTextEdit::setUndoRedoEnabled ( bool b )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setUndoRedoEnabled ( bool b )\fC [virtual slot]\fR" Sets whether undo/redo is enabled to \fIb\fR. See the "undoRedoEnabled" property for details. -.SH "void QTextEdit::setVerticalAlignment ( VerticalAlignment a )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setVerticalAlignment ( VerticalAlignment a )\fC [virtual slot]\fR" Sets the vertical alignment of the current format, i.e. of the text, to \fIa\fR. .PP See also color() and paper. -.SH "void QTextEdit::setWordWrap ( WordWrap mode )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setWordWrap ( WordWrap mode )\fC [virtual slot]\fR" Sets the word wrap mode to \fImode\fR. See the "wordWrap" property for details. -.SH "void QTextEdit::setWrapColumnOrWidth ( int )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setWrapColumnOrWidth ( int )\fC [virtual slot]\fR" Sets the position (in pixels or columns depending on the wrap mode) where text will be wrapped. See the "wrapColumnOrWidth" property for details. -.SH "void QTextEdit::setWrapPolicy ( WrapPolicy policy )\fC [virtual slot]\fR" +.SH "void TQTextEdit::setWrapPolicy ( WrapPolicy policy )\fC [virtual slot]\fR" Sets the word wrap policy, at whitespace or anywhere to \fIpolicy\fR. See the "wrapPolicy" property for details. -.SH "QStyleSheet * QTextEdit::styleSheet () const" +.SH "QStyleSheet * TQTextEdit::styleSheet () const" Returns the QStyleSheet which is being used by this text edit. .PP See also setStyleSheet(). .PP Examples: .)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, and mdi/application.cpp. -.SH "void QTextEdit::sync ()\fC [virtual slot]\fR" -QTextEdit is optimized for large amounts text. One of its optimizations is to format only the visible text, formatting the rest on demand, e.g. as the user scrolls, so you don't usually need to call this function. +.SH "void TQTextEdit::sync ()\fC [virtual slot]\fR" +TQTextEdit is optimized for large amounts text. One of its optimizations is to format only the visible text, formatting the rest on demand, e.g. as the user scrolls, so you don't usually need to call this function. .PP In some situations you may want to force the whole text to be formatted. For example, if after calling setText(), you wanted to know the height of the document (using contentsHeight()), you would call this function first. -.SH "QSyntaxHighlighter * QTextEdit::syntaxHighlighter () const" -Returns the QSyntaxHighlighter set on this QTextEdit. 0 is returned if no syntax highlighter is set. -.SH "bool QTextEdit::tabChangesFocus () const" +.SH "QSyntaxHighlighter * TQTextEdit::syntaxHighlighter () const" +Returns the QSyntaxHighlighter set on this TQTextEdit. 0 is returned if no syntax highlighter is set. +.SH "bool TQTextEdit::tabChangesFocus () const" Returns TRUE if TAB changes focus or is accepted as input; otherwise returns FALSE. See the "tabChangesFocus" property for details. -.SH "int QTextEdit::tabStopWidth () const" +.SH "int TQTextEdit::tabStopWidth () const" Returns the tab stop width in pixels. See the "tabStopWidth" property for details. -.SH "TQString QTextEdit::text () const" +.SH "TQString TQTextEdit::text () const" Returns the text edit's text. See the "text" property for details. -.SH "TQString QTextEdit::text ( int para ) const" +.SH "TQString TQTextEdit::text ( int para ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the text of paragraph \fIpara\fR. .PP If textFormat() is RichText the text will contain HTML formatting tags. -.SH "void QTextEdit::textChanged ()\fC [signal]\fR" +.SH "void TQTextEdit::textChanged ()\fC [signal]\fR" This signal is emitted whenever the text in the text edit changes. .PP See also text and append(). .PP Examples: .)l qwerty/qwerty.cpp and rot13/rot13.cpp. -.SH "QTextCursor * QTextEdit::textCursor () const\fC [protected]\fR" +.SH "TQTextCursor * TQTextEdit::textCursor () const\fC [protected]\fR" Returns the text edit's text cursor. .PP -\fBWarning:\fR QTextCursor is not in the public API, but in special circumstances you might wish to use it. -.SH "TextFormat QTextEdit::textFormat () const" +\fBWarning:\fR TQTextCursor is not in the public API, but in special circumstances you might wish to use it. +.SH "TextFormat TQTextEdit::textFormat () const" Returns the text format: rich text, plain text, log text or auto text. See the "textFormat" property for details. -.SH "bool QTextEdit::underline () const" +.SH "bool TQTextEdit::underline () const" Returns TRUE if the current format is underlined; otherwise returns FALSE. .PP See also setUnderline(). -.SH "void QTextEdit::undo ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::undo ()\fC [virtual slot]\fR" Undoes the last operation. .PP If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens. .PP See also undoAvailable(), redo(), and undoDepth. -.SH "void QTextEdit::undoAvailable ( bool yes )\fC [signal]\fR" +.SH "void TQTextEdit::undoAvailable ( bool yes )\fC [signal]\fR" This signal is emitted when the availability of undo changes. If \fIyes\fR is TRUE, then undo() will work until undoAvailable( FALSE ) is next emitted. .PP See also undo() and undoDepth. -.SH "int QTextEdit::undoDepth () const" +.SH "int TQTextEdit::undoDepth () const" Returns the depth of the undo history. See the "undoDepth" property for details. -.SH "WordWrap QTextEdit::wordWrap () const" +.SH "WordWrap TQTextEdit::wordWrap () const" Returns the word wrap mode. See the "wordWrap" property for details. -.SH "int QTextEdit::wrapColumnOrWidth () const" +.SH "int TQTextEdit::wrapColumnOrWidth () const" Returns the position (in pixels or columns depending on the wrap mode) where text will be wrapped. See the "wrapColumnOrWidth" property for details. -.SH "WrapPolicy QTextEdit::wrapPolicy () const" +.SH "WrapPolicy TQTextEdit::wrapPolicy () const" Returns the word wrap policy, at whitespace or anywhere. See the "wrapPolicy" property for details. -.SH "void QTextEdit::zoomIn ( int range )\fC [virtual slot]\fR" +.SH "void TQTextEdit::zoomIn ( int range )\fC [virtual slot]\fR" Zooms in on the text by making the base font size \fIrange\fR points larger and recalculating all font sizes to be the new size. This does not change the size of any images. .PP See also zoomOut(). -.SH "void QTextEdit::zoomIn ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::zoomIn ()\fC [virtual slot]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Zooms in on the text by making the base font size one point larger and recalculating all font sizes to be the new size. This does not change the size of any images. .PP See also zoomOut(). -.SH "void QTextEdit::zoomOut ( int range )\fC [virtual slot]\fR" +.SH "void TQTextEdit::zoomOut ( int range )\fC [virtual slot]\fR" Zooms out on the text by making the base font size \fIrange\fR points smaller and recalculating all font sizes to be the new size. This does not change the size of any images. .PP See also zoomIn(). -.SH "void QTextEdit::zoomOut ()\fC [virtual slot]\fR" +.SH "void TQTextEdit::zoomOut ()\fC [virtual slot]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Zooms out on the text by making the base font size one point smaller and recalculating all font sizes to be the new size. This does not change the size of any images. .PP See also zoomIn(). -.SH "void QTextEdit::zoomTo ( int size )\fC [virtual slot]\fR" +.SH "void TQTextEdit::zoomTo ( int size )\fC [virtual slot]\fR" Zooms the text by making the base font size \fIsize\fR points and recalculating all font sizes to be the new size. This does not change the size of any images. .SS "Property Documentation" .SH "AutoFormatting autoFormatting" @@ -1366,7 +1366,7 @@ On setting, any previous text is deleted. .PP The text may be interpreted either as plain text or as rich text, depending on the textFormat(). The default setting is AutoText, i.e. the text edit auto-detects the format of the text. .PP -For richtext, calling text() on an editable QTextEdit will cause the text to be regenerated from the textedit. This may mean that the TQString returned may not be exactly the same as the one that was set. +For richtext, calling text() on an editable TQTextEdit will cause the text to be regenerated from the textedit. This may mean that the TQString returned may not be exactly the same as the one that was set. .PP See also textFormat. .PP @@ -1427,7 +1427,7 @@ See also wordWrap. Set this property's value with setWrapPolicy() and get this property's value with wrapPolicy(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqtextedit.html +.BR http://doc.trolltech.com/tqtextedit.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextencoder.3qt b/doc/man/man3/tqtextencoder.3qt index b34653af..a74f2b20 100644 --- a/doc/man/man3/tqtextencoder.3qt +++ b/doc/man/man3/tqtextencoder.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextEncoder 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextEncoder 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,31 +7,31 @@ .ad l .nh .SH NAME -QTextEncoder \- State-based encoder +TQTextEncoder \- State-based encoder .SH SYNOPSIS All the functions in this class are reentrant when TQt is built with thread support.</p> .PP -\fC#include <ntqtextcodec.h>\fR +\fC#include <tqtextcodec.h>\fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "virtual \fB~QTextEncoder\fR ()" +.BI "virtual \fB~TQTextEncoder\fR ()" .br .ti -1c .BI "virtual QCString \fBfromUnicode\fR ( const TQString & uc, int & lenInOut ) = 0" .br .in -1c .SH DESCRIPTION -The QTextEncoder class provides a state-based encoder. +The TQTextEncoder class provides a state-based encoder. .PP The encoder converts Unicode into another format, remembering any state that is required between calls. .PP -See also QTextCodec::makeEncoder() and Internationalization with Qt. +See also TQTextCodec::makeEncoder() and Internationalization with Qt. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextEncoder::~QTextEncoder ()\fC [virtual]\fR" +.SH "TQTextEncoder::~TQTextEncoder ()\fC [virtual]\fR" Destroys the encoder. -.SH "QCString QTextEncoder::fromUnicode ( const TQString & uc, int & lenInOut )\fC [pure virtual]\fR" +.SH "QCString TQTextEncoder::fromUnicode ( const TQString & uc, int & lenInOut )\fC [pure virtual]\fR" Converts \fIlenInOut\fR characters (not bytes) from \fIuc\fR, producing a QCString. \fIlenInOut\fR will be set to the length of the result (in bytes). .PP The encoder is free to record state to use when subsequent calls @@ -40,7 +40,7 @@ escape sequences if needed during the encoding of one string, then assume that mode applies when a subsequent call begins). .SH "SEE ALSO" -.BR http://doc.trolltech.com/qtextencoder.html +.BR http://doc.trolltech.com/tqtextencoder.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextistream.3qt b/doc/man/man3/tqtextistream.3qt index 70842df8..2e26d9ba 100644 --- a/doc/man/man3/tqtextistream.3qt +++ b/doc/man/man3/tqtextistream.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextIStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextIStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,30 +7,30 @@ .ad l .nh .SH NAME -QTextIStream \- Convenience class for input streams +TQTextIStream \- Convenience class for input streams .SH SYNOPSIS All the functions in this class are reentrant when TQt is built with thread support.</p> .PP -\fC#include <ntqtextstream.h>\fR +\fC#include <tqtextstream.h>\fR .PP -Inherits QTextStream. +Inherits TQTextStream. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQTextIStream\fR ( const TQString * s )" +.BI "\fBTQTextIStream\fR ( const TQString * s )" .br .ti -1c -.BI "\fBQTextIStream\fR ( QByteArray ba )" +.BI "\fBTQTextIStream\fR ( QByteArray ba )" .br .ti -1c -.BI "\fBQTextIStream\fR ( FILE * f )" +.BI "\fBTQTextIStream\fR ( FILE * f )" .br .in -1c .SH DESCRIPTION -The QTextIStream class is a convenience class for input streams. +The TQTextIStream class is a convenience class for input streams. .PP -This class provides a shorthand for creating simple input QTextStreams without having to pass a \fImode\fR argument to the constructor. +This class provides a shorthand for creating simple input TQTextStreams without having to pass a \fImode\fR argument to the constructor. .PP This class makes it easy, for example, to write things like this: .PP @@ -40,21 +40,21 @@ This class makes it easy, for example, to write things like this: .br int a, b; .br - QTextIStream(&data) >> a >> b; + TQTextIStream(&data) >> a >> b; .br .fi .PP -See also QTextOStream, Input/Output and Networking, and Text Related Classes. +See also TQTextOStream, Input/Output and Networking, and Text Related Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextIStream::QTextIStream ( const TQString * s )" +.SH "TQTextIStream::TQTextIStream ( const TQString * s )" Constructs a stream to read from the string \fIs\fR. -.SH "QTextIStream::QTextIStream ( QByteArray ba )" +.SH "TQTextIStream::TQTextIStream ( QByteArray ba )" Constructs a stream to read from the array \fIba\fR. -.SH "QTextIStream::QTextIStream ( FILE * f )" +.SH "TQTextIStream::TQTextIStream ( FILE * f )" Constructs a stream to read from the file \fIf\fR. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qtextistream.html +.BR http://doc.trolltech.com/tqtextistream.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextostream.3qt b/doc/man/man3/tqtextostream.3qt index 5af7c517..51991285 100644 --- a/doc/man/man3/tqtextostream.3qt +++ b/doc/man/man3/tqtextostream.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextOStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextOStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,30 +7,30 @@ .ad l .nh .SH NAME -QTextOStream \- Convenience class for output streams +TQTextOStream \- Convenience class for output streams .SH SYNOPSIS All the functions in this class are reentrant when TQt is built with thread support.</p> .PP -\fC#include <ntqtextstream.h>\fR +\fC#include <tqtextstream.h>\fR .PP -Inherits QTextStream. +Inherits TQTextStream. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQTextOStream\fR ( TQString * s )" +.BI "\fBTQTextOStream\fR ( TQString * s )" .br .ti -1c -.BI "\fBQTextOStream\fR ( QByteArray ba )" +.BI "\fBTQTextOStream\fR ( QByteArray ba )" .br .ti -1c -.BI "\fBQTextOStream\fR ( FILE * f )" +.BI "\fBTQTextOStream\fR ( FILE * f )" .br .in -1c .SH DESCRIPTION -The QTextOStream class is a convenience class for output streams. +The TQTextOStream class is a convenience class for output streams. .PP -This class provides a shorthand for creating simple output QTextStreams without having to pass a \fImode\fR argument to the constructor. +This class provides a shorthand for creating simple output TQTextStreams without having to pass a \fImode\fR argument to the constructor. .PP This makes it easy for example, to write things like this: .PP @@ -38,21 +38,21 @@ This makes it easy for example, to write things like this: .br TQString result; .br - QTextOStream(&result) << "pi = " << 3.14; + TQTextOStream(&result) << "pi = " << 3.14; .br .fi .PP See also Input/Output and Networking and Text Related Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextOStream::QTextOStream ( TQString * s )" +.SH "TQTextOStream::TQTextOStream ( TQString * s )" Constructs a stream to write to string \fIs\fR. -.SH "QTextOStream::QTextOStream ( QByteArray ba )" +.SH "TQTextOStream::TQTextOStream ( QByteArray ba )" Constructs a stream to write to the array \fIba\fR. -.SH "QTextOStream::QTextOStream ( FILE * f )" +.SH "TQTextOStream::TQTextOStream ( FILE * f )" Constructs a stream to write to the file \fIf\fR. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qtextostream.html +.BR http://doc.trolltech.com/tqtextostream.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtextstream.3qt b/doc/man/man3/tqtextstream.3qt index 0b99605b..f9373929 100644 --- a/doc/man/man3/tqtextstream.3qt +++ b/doc/man/man3/tqtextstream.3qt @@ -1,5 +1,5 @@ '\" t -.TH QTextStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQTextStream 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,13 +7,13 @@ .ad l .nh .SH NAME -QTextStream \- Basic functions for reading and writing text using a TQIODevice +TQTextStream \- Basic functions for reading and writing text using a TQIODevice .SH SYNOPSIS All the functions in this class are reentrant when TQt is built with thread support.</p> .PP -\fC#include <ntqtextstream.h>\fR +\fC#include <tqtextstream.h>\fR .PP -Inherited by QTextIStream and QTextOStream. +Inherited by TQTextIStream and TQTextOStream. .PP .SS "Public Members" .in +1c @@ -24,31 +24,31 @@ Inherited by QTextIStream and QTextOStream. .BI "void \fBsetEncoding\fR ( Encoding e )" .br .ti -1c -.BI "void \fBsetCodec\fR ( QTextCodec * codec )" +.BI "void \fBsetCodec\fR ( TQTextCodec * codec )" .br .ti -1c -.BI "QTextCodec * \fBcodec\fR ()" +.BI "TQTextCodec * \fBcodec\fR ()" .br .ti -1c -.BI "\fBQTextStream\fR ()" +.BI "\fBTQTextStream\fR ()" .br .ti -1c -.BI "\fBQTextStream\fR ( TQIODevice * iod )" +.BI "\fBTQTextStream\fR ( TQIODevice * iod )" .br .ti -1c -.BI "\fBQTextStream\fR ( TQString * str, int filemode )" +.BI "\fBTQTextStream\fR ( TQString * str, int filemode )" .br .ti -1c -.BI "QTextStream ( TQString & str, int filemode ) \fI(obsolete)\fR" +.BI "TQTextStream ( TQString & str, int filemode ) \fI(obsolete)\fR" .br .ti -1c -.BI "\fBQTextStream\fR ( QByteArray a, int mode )" +.BI "\fBTQTextStream\fR ( QByteArray a, int mode )" .br .ti -1c -.BI "\fBQTextStream\fR ( FILE * fh, int mode )" +.BI "\fBTQTextStream\fR ( FILE * fh, int mode )" .br .ti -1c -.BI "virtual \fB~QTextStream\fR ()" +.BI "virtual \fB~TQTextStream\fR ()" .br .ti -1c .BI "TQIODevice * \fBdevice\fR () const" @@ -66,91 +66,91 @@ Inherited by QTextIStream and QTextOStream. .BI "bool eof () const \fI(obsolete)\fR" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( TQChar & c )" +.BI "TQTextStream & \fBoperator>>\fR ( TQChar & c )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( char & c )" +.BI "TQTextStream & \fBoperator>>\fR ( char & c )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( signed short & i )" +.BI "TQTextStream & \fBoperator>>\fR ( signed short & i )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( unsigned short & i )" +.BI "TQTextStream & \fBoperator>>\fR ( unsigned short & i )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( signed int & i )" +.BI "TQTextStream & \fBoperator>>\fR ( signed int & i )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( unsigned int & i )" +.BI "TQTextStream & \fBoperator>>\fR ( unsigned int & i )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( signed long & i )" +.BI "TQTextStream & \fBoperator>>\fR ( signed long & i )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( unsigned long & i )" +.BI "TQTextStream & \fBoperator>>\fR ( unsigned long & i )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( float & f )" +.BI "TQTextStream & \fBoperator>>\fR ( float & f )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( double & f )" +.BI "TQTextStream & \fBoperator>>\fR ( double & f )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( char * s )" +.BI "TQTextStream & \fBoperator>>\fR ( char * s )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( TQString & str )" +.BI "TQTextStream & \fBoperator>>\fR ( TQString & str )" .br .ti -1c -.BI "QTextStream & \fBoperator>>\fR ( QCString & str )" +.BI "TQTextStream & \fBoperator>>\fR ( QCString & str )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( TQChar c )" +.BI "TQTextStream & \fBoperator<<\fR ( TQChar c )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( char c )" +.BI "TQTextStream & \fBoperator<<\fR ( char c )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( signed short i )" +.BI "TQTextStream & \fBoperator<<\fR ( signed short i )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( unsigned short i )" +.BI "TQTextStream & \fBoperator<<\fR ( unsigned short i )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( signed int i )" +.BI "TQTextStream & \fBoperator<<\fR ( signed int i )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( unsigned int i )" +.BI "TQTextStream & \fBoperator<<\fR ( unsigned int i )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( signed long i )" +.BI "TQTextStream & \fBoperator<<\fR ( signed long i )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( unsigned long i )" +.BI "TQTextStream & \fBoperator<<\fR ( unsigned long i )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( float f )" +.BI "TQTextStream & \fBoperator<<\fR ( float f )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( double f )" +.BI "TQTextStream & \fBoperator<<\fR ( double f )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( const char * s )" +.BI "TQTextStream & \fBoperator<<\fR ( const char * s )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( const TQString & s )" +.BI "TQTextStream & \fBoperator<<\fR ( const TQString & s )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( const QCString & s )" +.BI "TQTextStream & \fBoperator<<\fR ( const QCString & s )" .br .ti -1c -.BI "QTextStream & \fBoperator<<\fR ( void * ptr )" +.BI "TQTextStream & \fBoperator<<\fR ( void * ptr )" .br .ti -1c -.BI "QTextStream & \fBreadRawBytes\fR ( char * s, uint len )" +.BI "TQTextStream & \fBreadRawBytes\fR ( char * s, uint len )" .br .ti -1c -.BI "QTextStream & \fBwriteRawBytes\fR ( const char * s, uint len )" +.BI "TQTextStream & \fBwriteRawBytes\fR ( const char * s, uint len )" .br .ti -1c .BI "TQString \fBreadLine\fR ()" @@ -199,50 +199,50 @@ Inherited by QTextIStream and QTextOStream. .br .in -1c .SH DESCRIPTION -The QTextStream class provides basic functions for reading and writing text using a TQIODevice. +The TQTextStream class provides basic functions for reading and writing text using a TQIODevice. .PP The text stream class has a functional interface that is very similar to that of the standard C++ iostream class. .PP Qt provides several global functions similar to the ones in iostream: <center>.nf .TS -l - l. Function Meaning bin sets the QTextStream to read/write binary numbers oct sets the QTextStream to read/write octal numbers dec sets the QTextStream to read/write decimal numbers hex sets the QTextStream to read/write hexadecimal numbers endl forces a line break flush forces the TQIODevice to flush any buffered data ws eats any available whitespace (on input) reset resets the QTextStream to its default mode (see reset()) qSetW(int) sets the field width to the given argument qSetFill(int) sets the fill character to the given argument qSetPrecision(int) +l - l. Function Meaning bin sets the TQTextStream to read/write binary numbers oct sets the TQTextStream to read/write octal numbers dec sets the TQTextStream to read/write decimal numbers hex sets the TQTextStream to read/write hexadecimal numbers endl forces a line break flush forces the TQIODevice to flush any buffered data ws eats any available whitespace (on input) reset resets the TQTextStream to its default mode (see reset()) qSetW(int) sets the field width to the given argument qSetFill(int) sets the fill character to the given argument qSetPrecision(int) .TE .fi </center> .PP -\fBWarning:\fR By default QTextStream will automatically detect whether integers in the stream are in decimal, octal, hexadecimal or binary format when reading from the stream. In particular, a leading '0' signifies octal, i.e. the sequence "0100" will be interpreted as 64. +\fBWarning:\fR By default TQTextStream will automatically detect whether integers in the stream are in decimal, octal, hexadecimal or binary format when reading from the stream. In particular, a leading '0' signifies octal, i.e. the sequence "0100" will be interpreted as 64. .PP -The QTextStream class reads and writes text; it is not appropriate for dealing with binary data (but QDataStream is). +The TQTextStream class reads and writes text; it is not appropriate for dealing with binary data (but QDataStream is). .PP -By default, output of Unicode text (i.e. TQString) is done using the local 8-bit encoding. This can be changed using the setEncoding() method. For input, the QTextStream will auto-detect standard Unicode "byte order marked" text files; otherwise the local 8-bit encoding is used. +By default, output of Unicode text (i.e. TQString) is done using the local 8-bit encoding. This can be changed using the setEncoding() method. For input, the TQTextStream will auto-detect standard Unicode "byte order marked" text files; otherwise the local 8-bit encoding is used. .PP The TQIODevice is set in the constructor, or later using setDevice(). If the end of the input is reached atEnd() returns TRUE. Data can be read into variables of the appropriate type using the operator>>() overloads, or read in its entirety into a single string using read(), or read a line at a time using readLine(). Whitespace can be skipped over using skipWhiteSpace(). You can set flags for the stream using flags() or setf(). The stream also supports width(), precision() and fill(); use reset() to reset the defaults. .PP See also QDataStream, Input/Output and Networking, and Text Related Classes. .SS "Member Type Documentation" -.SH "QTextStream::Encoding" +.SH "TQTextStream::Encoding" .TP -\fCQTextStream::Locale\fR +\fCTQTextStream::Locale\fR .TP -\fCQTextStream::Latin1\fR +\fCTQTextStream::Latin1\fR .TP -\fCQTextStream::Unicode\fR +\fCTQTextStream::Unicode\fR .TP -\fCQTextStream::UnicodeNetworkOrder\fR +\fCTQTextStream::UnicodeNetworkOrder\fR .TP -\fCQTextStream::UnicodeReverse\fR +\fCTQTextStream::UnicodeReverse\fR .TP -\fCQTextStream::RawUnicode\fR +\fCTQTextStream::RawUnicode\fR .TP -\fCQTextStream::UnicodeUTF8\fR +\fCTQTextStream::UnicodeUTF8\fR .PP See setEncoding() for an explanation of the encodings. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QTextStream::QTextStream ()" +.SH "TQTextStream::TQTextStream ()" Constructs a data stream that has no IO device. -.SH "QTextStream::QTextStream ( TQIODevice * iod )" +.SH "TQTextStream::TQTextStream ( TQIODevice * iod )" Constructs a text stream that uses the IO device \fIiod\fR. -.SH "QTextStream::QTextStream ( TQString * str, int filemode )" +.SH "TQTextStream::TQTextStream ( TQString * str, int filemode )" Constructs a text stream that operates on the Unicode TQString, \fIstr\fR, through an internal device. The \fIfilemode\fR argument is passed to the device's open() function; see TQIODevice::mode(). .PP If you set an encoding or codec with setEncoding() or setCodec(), this setting is ignored for text streams that operate on TQString. @@ -253,7 +253,7 @@ Example: .br TQString str; .br - QTextStream ts( &str, IO_WriteOnly ); + TQTextStream ts( &str, IO_WriteOnly ); .br ts << "pi = " << 3.14; // str == "pi = 3.14" .br @@ -265,18 +265,18 @@ Writing data to the text stream will modify the contents of the string. The stri .br TQString str = "pi = 3.14"; .br - QTextStream ts( &str, IO_WriteOnly ); + TQTextStream ts( &str, IO_WriteOnly ); .br ts << "2+2 = " << 2+2; // str == "2+2 = 414" .br .fi .PP Note that because TQString is Unicode, you should not use readRawBytes() or writeRawBytes() on such a stream. -.SH "QTextStream::QTextStream ( TQString & str, int filemode )" +.SH "TQTextStream::TQTextStream ( TQString & str, int filemode )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP This constructor is equivalent to the constructor taking a TQString* parameter. -.SH "QTextStream::QTextStream ( QByteArray a, int mode )" +.SH "TQTextStream::TQTextStream ( QByteArray a, int mode )" Constructs a text stream that operates on the byte array, \fIa\fR, through an internal QBuffer device. The \fImode\fR argument is passed to the device's open() function; see TQIODevice::mode(). .PP Example: @@ -285,7 +285,7 @@ Example: .br QByteArray array; .br - QTextStream ts( array, IO_WriteOnly ); + TQTextStream ts( array, IO_WriteOnly ); .br ts << "pi = " << 3.14 << '\\0'; // array == "pi = 3.14" .br @@ -303,39 +303,39 @@ Same example, using a QBuffer: .br buf.open( IO_WriteOnly ); .br - QTextStream ts( &buf ); + TQTextStream ts( &buf ); .br ts << "pi = " << 3.14 << '\\0'; // array == "pi = 3.14" .br buf.close(); .br .fi -.SH "QTextStream::QTextStream ( FILE * fh, int mode )" +.SH "TQTextStream::TQTextStream ( FILE * fh, int mode )" Constructs a text stream that operates on an existing file handle \fIfh\fR through an internal QFile device. The \fImode\fR argument is passed to the device's open() function; see TQIODevice::mode(). .PP -Note that if you create a QTextStream \fCcout\fR or another name that is also used for another variable of a different type, some linkers may confuse the two variables, which will often cause crashes. -.SH "QTextStream::~QTextStream ()\fC [virtual]\fR" +Note that if you create a TQTextStream \fCcout\fR or another name that is also used for another variable of a different type, some linkers may confuse the two variables, which will often cause crashes. +.SH "TQTextStream::~TQTextStream ()\fC [virtual]\fR" Destroys the text stream. .PP The destructor does not affect the current IO device. -.SH "bool QTextStream::atEnd () const" +.SH "bool TQTextStream::atEnd () const" Returns TRUE if the IO device has reached the end position (end of the stream or file) or if there is no IO device set; otherwise returns FALSE. .PP See also TQIODevice::atEnd(). .PP Examples: .)l addressbook/centralwidget.cpp and grapher/grapher.cpp. -.SH "QTextCodec * QTextStream::codec ()" +.SH "TQTextCodec * TQTextStream::codec ()" Returns the codec actually used for this stream. .PP If Unicode is automatically detected in input, a codec with name() "ISO-10646-UCS-2" is returned. .PP See also setCodec(). -.SH "TQIODevice * QTextStream::device () const" +.SH "TQIODevice * TQTextStream::device () const" Returns the IO device currently set. .PP See also setDevice() and unsetDevice(). -.SH "bool QTextStream::eof () const" +.SH "bool TQTextStream::eof () const" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP This function has been renamed to atEnd(). @@ -343,13 +343,13 @@ This function has been renamed to atEnd(). See also TQIODevice::atEnd(). .PP Example: chart/chartform_files.cpp. -.SH "int QTextStream::fill () const" +.SH "int TQTextStream::fill () const" Returns the fill character. The default value is ' ' (space). -.SH "int QTextStream::fill ( int f )" +.SH "int TQTextStream::fill ( int f )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Sets the fill character to \fIf\fR. Returns the previous fill character. -.SH "int QTextStream::flags () const" +.SH "int TQTextStream::flags () const" Returns the current stream flags. The default value is 0. .PP <center>.nf @@ -379,144 +379,144 @@ Flag Meaning Note that unless \fCbin\fR, \fCoct\fR, \fCdec\fR, or \fChex\fR is set, the input base is octal if the value starts with 0, hexadecimal if it starts with 0x, binary if it starts with 0b, and decimal otherwise. .PP See also setf() and unsetf(). -.SH "int QTextStream::flags ( int f )" +.SH "int TQTextStream::flags ( int f )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Sets the stream flags to \fIf\fR. Returns the previous stream flags. .PP See also setf() and unsetf(). -.SH "QTextStream & QTextStream::operator<< ( TQChar c )" +.SH "TQTextStream & TQTextStream::operator<< ( TQChar c )" Writes character \fCchar\fR to the stream and returns a reference to the stream. .PP -The character \fIc\fR is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream. -.SH "QTextStream & QTextStream::operator<< ( char c )" +The character \fIc\fR is assumed to be Latin1 encoded independent of the Encoding set for the TQTextStream. +.SH "TQTextStream & TQTextStream::operator<< ( char c )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes character \fIc\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( signed short i )" +.SH "TQTextStream & TQTextStream::operator<< ( signed short i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes a \fCshort\fR integer \fIi\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( unsigned short i )" +.SH "TQTextStream & TQTextStream::operator<< ( unsigned short i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes an \fCunsigned\fR \fCshort\fR integer \fIi\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( signed int i )" +.SH "TQTextStream & TQTextStream::operator<< ( signed int i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes an \fCint\fR \fIi\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( unsigned int i )" +.SH "TQTextStream & TQTextStream::operator<< ( unsigned int i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes an \fCunsigned\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( signed long i )" +.SH "TQTextStream & TQTextStream::operator<< ( signed long i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes a \fClong\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( unsigned long i )" +.SH "TQTextStream & TQTextStream::operator<< ( unsigned long i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes an \fCunsigned\fR \fClong\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( float f )" +.SH "TQTextStream & TQTextStream::operator<< ( float f )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes a \fCfloat\fR \fIf\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( double f )" +.SH "TQTextStream & TQTextStream::operator<< ( double f )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes a \fCdouble\fR \fIf\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( const char * s )" +.SH "TQTextStream & TQTextStream::operator<< ( const char * s )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes a string to the stream and returns a reference to the stream. .PP -The string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream. -.SH "QTextStream & QTextStream::operator<< ( const TQString & s )" +The string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the TQTextStream. +.SH "TQTextStream & TQTextStream::operator<< ( const TQString & s )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes \fIs\fR to the stream and returns a reference to the stream. -.SH "QTextStream & QTextStream::operator<< ( const QCString & s )" +.SH "TQTextStream & TQTextStream::operator<< ( const QCString & s )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes \fIs\fR to the stream and returns a reference to the stream. .PP -The string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream. -.SH "QTextStream & QTextStream::operator<< ( void * ptr )" +The string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the TQTextStream. +.SH "TQTextStream & TQTextStream::operator<< ( void * ptr )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Writes a pointer to the stream and returns a reference to the stream. .PP The \fIptr\fR is output as an unsigned long hexadecimal integer. -.SH "QTextStream & QTextStream::operator>> ( TQChar & c )" +.SH "TQTextStream & TQTextStream::operator>> ( TQChar & c )" Reads a char \fIc\fR from the stream and returns a reference to the stream. Note that whitespace is \fInot\fR skipped. -.SH "QTextStream & QTextStream::operator>> ( char & c )" +.SH "TQTextStream & TQTextStream::operator>> ( char & c )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a char \fIc\fR from the stream and returns a reference to the stream. Note that whitespace is skipped. -.SH "QTextStream & QTextStream::operator>> ( signed short & i )" +.SH "TQTextStream & TQTextStream::operator>> ( signed short & i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a signed \fCshort\fR integer \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( unsigned short & i )" +.SH "TQTextStream & TQTextStream::operator>> ( unsigned short & i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads an unsigned \fCshort\fR integer \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( signed int & i )" +.SH "TQTextStream & TQTextStream::operator>> ( signed int & i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a signed \fCint\fR \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( unsigned int & i )" +.SH "TQTextStream & TQTextStream::operator>> ( unsigned int & i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads an unsigned \fCint\fR \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( signed long & i )" +.SH "TQTextStream & TQTextStream::operator>> ( signed long & i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a signed \fClong\fR int \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( unsigned long & i )" +.SH "TQTextStream & TQTextStream::operator>> ( unsigned long & i )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads an unsigned \fClong\fR int \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( float & f )" +.SH "TQTextStream & TQTextStream::operator>> ( float & f )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a \fCfloat\fR \fIf\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( double & f )" +.SH "TQTextStream & TQTextStream::operator>> ( double & f )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a \fCdouble\fR \fIf\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format. -.SH "QTextStream & QTextStream::operator>> ( char * s )" +.SH "TQTextStream & TQTextStream::operator>> ( char * s )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a "word" from the stream into \fIs\fR and returns a reference to the stream. .PP A word consists of characters for which isspace() returns FALSE. -.SH "QTextStream & QTextStream::operator>> ( TQString & str )" +.SH "TQTextStream & TQTextStream::operator>> ( TQString & str )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a "word" from the stream into \fIstr\fR and returns a reference to the stream. .PP A word consists of characters for which isspace() returns FALSE. -.SH "QTextStream & QTextStream::operator>> ( QCString & str )" +.SH "TQTextStream & TQTextStream::operator>> ( QCString & str )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Reads a "word" from the stream into \fIstr\fR and returns a reference to the stream. .PP A word consists of characters for which isspace() returns FALSE. -.SH "int QTextStream::precision () const" +.SH "int TQTextStream::precision () const" Returns the precision. The default value is 6. -.SH "int QTextStream::precision ( int p )" +.SH "int TQTextStream::precision ( int p )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Sets the precision to \fIp\fR. Returns the previous precision setting. -.SH "TQString QTextStream::read ()" +.SH "TQString TQTextStream::read ()" Reads the entire stream from the current position, and returns a string containing the text. .PP See also TQIODevice::readLine(). .PP Examples: .)l action/application.cpp, application/application.cpp, mdi/application.cpp, qdir/qdir.cpp, and qwerty/qwerty.cpp. -.SH "TQString QTextStream::readLine ()" +.SH "TQString TQTextStream::readLine ()" Reads a line from the stream and returns a string containing the text. .PP The returned string does not contain any trailing newline or carriage return. Note that this is different from TQIODevice::readLine(), which does not strip the newline at the end of the line. @@ -527,7 +527,7 @@ See also TQIODevice::readLine(). .PP Examples: .)l addressbook/centralwidget.cpp, chart/element.cpp, and network/clientserver/server/server.cpp. -.SH "QTextStream & QTextStream::readRawBytes ( char * s, uint len )" +.SH "TQTextStream & TQTextStream::readRawBytes ( char * s, uint len )" Reads \fIlen\fR bytes from the stream into \fIs\fR and returns a reference to the stream. .PP The buffer \fIs\fR must be preallocated. @@ -537,7 +537,7 @@ Note that no encoding is done by this function. \fBWarning:\fR The behavior of this function is undefined unless the stream's encoding is set to Unicode or Latin1. .PP See also TQIODevice::readBlock(). -.SH "void QTextStream::reset ()" +.SH "void TQTextStream::reset ()" Resets the text stream. .TP All flags are set to 0. @@ -549,7 +549,7 @@ The fill character is set to ' ' (Space). The precision is set to 6. .PP See also setf(), width(), fill(), and precision(). -.SH "void QTextStream::setCodec ( QTextCodec * codec )" +.SH "void TQTextStream::setCodec ( TQTextCodec * codec )" Sets the codec for this stream to \fIcodec\fR. Will not try to autodetect Unicode. .PP Note that this function should be called before any data is read to/written from the stream. @@ -557,11 +557,11 @@ Note that this function should be called before any data is read to/written from See also setEncoding() and codec(). .PP Example: qwerty/qwerty.cpp. -.SH "void QTextStream::setDevice ( TQIODevice * iod )" +.SH "void TQTextStream::setDevice ( TQIODevice * iod )" Sets the IO device to \fIiod\fR. .PP See also device() and unsetDevice(). -.SH "void QTextStream::setEncoding ( Encoding e )" +.SH "void TQTextStream::setEncoding ( Encoding e )" Sets the encoding of this stream to \fIe\fR, where \fIe\fR is one of the following values: <center>.nf .TS l - l. Encoding Meaning Locale Uses local file format (Latin1 if locale is not set), but autodetecting Unicode(utf16) on input. Unicode Uses Unicode(utf16) for input and output. Output will be written in the order most efficient for the current platform (i.e. the order used internally in TQString). UnicodeUTF8 Using Unicode(utf8) for input and output. If you use it for input it will autodetect utf16 and use it instead of utf8. Latin1 ISO-8859-1. Will not autodetect utf16. UnicodeNetworkOrder Uses network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker. UnicodeReverse Uses reverse network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker or when writing data that should be read by buggy Windows applications. RawUnicode @@ -577,13 +577,13 @@ See also setCodec(). .PP Examples: .)l addressbook/centralwidget.cpp, network/httpd/httpd.cpp, and qwerty/qwerty.cpp. -.SH "int QTextStream::setf ( int bits )" +.SH "int TQTextStream::setf ( int bits )" Sets the stream flag bits \fIbits\fR. Returns the previous stream flags. .PP Equivalent to \fCflags( flags() | bits )\fR. .PP See also unsetf(). -.SH "int QTextStream::setf ( int bits, int mask )" +.SH "int TQTextStream::setf ( int bits, int mask )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Sets the stream flag bits \fIbits\fR with a bit mask \fImask\fR. Returns the previous stream flags. @@ -591,25 +591,25 @@ Sets the stream flag bits \fIbits\fR with a bit mask \fImask\fR. Returns the pre Equivalent to \fCflags( (flags() & ~mask) | (bits & mask) )\fR. .PP See also unsetf(). -.SH "void QTextStream::skipWhiteSpace ()" +.SH "void TQTextStream::skipWhiteSpace ()" Positions the read pointer at the first non-whitespace character. -.SH "void QTextStream::unsetDevice ()" +.SH "void TQTextStream::unsetDevice ()" Unsets the IO device. Equivalent to setDevice( 0 ). .PP See also device() and setDevice(). -.SH "int QTextStream::unsetf ( int bits )" +.SH "int TQTextStream::unsetf ( int bits )" Clears the stream flag bits \fIbits\fR. Returns the previous stream flags. .PP Equivalent to \fCflags( flags() & ~mask )\fR. .PP See also setf(). -.SH "int QTextStream::width () const" +.SH "int TQTextStream::width () const" Returns the field width. The default value is 0. -.SH "int QTextStream::width ( int w )" +.SH "int TQTextStream::width ( int w )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Sets the field width to \fIw\fR. Returns the previous field width. -.SH "QTextStream & QTextStream::writeRawBytes ( const char * s, uint len )" +.SH "TQTextStream & TQTextStream::writeRawBytes ( const char * s, uint len )" Writes the \fIlen\fR bytes from \fIs\fR to the stream and returns a reference to the stream. .PP Note that no encoding is done by this function. @@ -617,7 +617,7 @@ Note that no encoding is done by this function. See also TQIODevice::writeBlock(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqtextstream.html +.BR http://doc.trolltech.com/tqtextstream.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqtsciicodec.3qt b/doc/man/man3/tqtsciicodec.3qt index 919deda2..ba46ea0d 100644 --- a/doc/man/man3/tqtsciicodec.3qt +++ b/doc/man/man3/tqtsciicodec.3qt @@ -13,7 +13,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .PP \fC#include <ntqtsciicodec.h>\fR .PP -Inherits QTextCodec. +Inherits TQTextCodec. .PP .SH DESCRIPTION The QTsciiCodec class provides conversion to and from the Tamil TSCII encoding. diff --git a/doc/man/man3/tqwidget.3qt b/doc/man/man3/tqwidget.3qt index 08eeaae1..00242f28 100644 --- a/doc/man/man3/tqwidget.3qt +++ b/doc/man/man3/tqwidget.3qt @@ -1298,7 +1298,7 @@ This event handler is called when a drag is in progress and the mouse enters thi .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, TQImageDrag, and QDragEnterEvent. +See also TQTextDrag, TQImageDrag, and QDragEnterEvent. .PP Example: iconview/simple_dd/main.cpp. .SH "void TQWidget::dragLeaveEvent ( QDragLeaveEvent * )\fC [virtual protected]\fR" @@ -1306,13 +1306,13 @@ This event handler is called when a drag is in progress and the mouse leaves thi .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, TQImageDrag, and QDragLeaveEvent. +See also TQTextDrag, TQImageDrag, and QDragLeaveEvent. .SH "void TQWidget::dragMoveEvent ( QDragMoveEvent * )\fC [virtual protected]\fR" This event handler is called when a drag is in progress and the mouse enters this widget, and whenever it moves within the widget. .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, TQImageDrag, and QDragMoveEvent. +See also TQTextDrag, TQImageDrag, and QDragMoveEvent. .SH "void TQWidget::drawText ( int x, int y, const TQString & str )" Draws the string \fIstr\fR at position \fI(x, y)\fR. .PP @@ -1330,7 +1330,7 @@ This event handler is called when the drag is dropped on this widget. .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, TQImageDrag, and QDropEvent. +See also TQTextDrag, TQImageDrag, and QDropEvent. .PP Example: iconview/simple_dd/main.cpp. .SH "void TQWidget::enabledChange ( bool oldEnabled )\fC [virtual protected]\fR" @@ -1517,7 +1517,7 @@ Returns the preferred height for this widget, given the width \fIw\fR. The defau .PP \fBWarning:\fR Does not look at the widget's layout. .PP -Reimplemented in QMenuBar and QTextEdit. +Reimplemented in QMenuBar and TQTextEdit. .SH "void TQWidget::hide ()\fC [virtual slot]\fR" Hides the widget. .PP @@ -1632,7 +1632,7 @@ See also keyReleaseEvent(), QKeyEvent::ignore(), focusPolicy, focusInEvent(), fo .PP Example: picture/picture.cpp. .PP -Reimplemented in QLineEdit and QTextEdit. +Reimplemented in QLineEdit and TQTextEdit. .SH "void TQWidget::keyReleaseEvent ( QKeyEvent * e )\fC [virtual protected]\fR" This event handler, for event \fIe\fR, can be reimplemented in a subclass to receive key release events for the widget. .PP @@ -2112,7 +2112,7 @@ Sets enables or disables the use of input methods for this widget to \fIb\fR. Se .SH "void TQWidget::setKeyCompression ( bool compress )\fC [virtual protected]\fR" Enables key event compression, if \fIcompress\fR is TRUE, and disables it if \fIcompress\fR is FALSE. .PP -Key compression is off by default (except for QLineEdit and QTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to compress key events so that more than one character can be processed in each event. +Key compression is off by default (except for QLineEdit and TQTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to compress key events so that more than one character can be processed in each event. .PP For example, a word processor widget might receive 2, 3 or more characters in each QKeyEvent::text(), if the layout recalculation takes too long for the CPU. .PP diff --git a/doc/man/man3/tqwindowsmime.3qt b/doc/man/man3/tqwindowsmime.3qt index c2a03470..a8d6181a 100644 --- a/doc/man/man3/tqwindowsmime.3qt +++ b/doc/man/man3/tqwindowsmime.3qt @@ -68,9 +68,9 @@ By instantiating subclasses of QWindowsMime that provide conversions between Win .PP Qt has predefined support for the following Windows Clipboard formats: .TP -CF_UNICODETEXT - converted to "text/plain;charset=ISO-10646-UCS-2" and supported by QTextDrag. +CF_UNICODETEXT - converted to "text/plain;charset=ISO-10646-UCS-2" and supported by TQTextDrag. .TP -CF_TEXT - converted to "text/plain;charset=system" or "text/plain" and supported by QTextDrag. +CF_TEXT - converted to "text/plain;charset=system" or "text/plain" and supported by TQTextDrag. .TP CF_DIB - converted to "image/*", where * is a TQt image format, and supported by TQImageDrag. .TP diff --git a/doc/man/man3/tqxmlinputsource.3qt b/doc/man/man3/tqxmlinputsource.3qt index 5801fb58..36565570 100644 --- a/doc/man/man3/tqxmlinputsource.3qt +++ b/doc/man/man3/tqxmlinputsource.3qt @@ -25,7 +25,7 @@ All the functions in this class are reentrant when TQt is built with thread supp .BI "TQXmlInputSource ( QFile & file ) \fI(obsolete)\fR" .br .ti -1c -.BI "TQXmlInputSource ( QTextStream & stream ) \fI(obsolete)\fR" +.BI "TQXmlInputSource ( TQTextStream & stream ) \fI(obsolete)\fR" .br .ti -1c .BI "virtual \fB~TQXmlInputSource\fR ()" @@ -84,7 +84,7 @@ See also setData(), fetchData(), and TQIODevice. \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP Constructs an input source and gets the data from the file \fIfile\fR. If the file cannot be read the input source is empty. -.SH "TQXmlInputSource::TQXmlInputSource ( QTextStream & stream )" +.SH "TQXmlInputSource::TQXmlInputSource ( TQTextStream & stream )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP Constructs an input source and gets the data from the text stream \fIstream\fR. diff --git a/doc/networking.doc b/doc/networking.doc index fe7b0e79..f99f75db 100644 --- a/doc/networking.doc +++ b/doc/networking.doc @@ -218,7 +218,7 @@ ClientSocket constructor connects QSocket::readyRead() signal which is emitted w This slot is called every time we receive some data via socket. Our communication protocol is textual and line oriented, and socket communication is asynchronous (don't forget that, we don't know when readyRead() will be emitted, or will that be at the end of the line), so we have to check with QSocket::canReadLine() if the full line has been received. Because each input line presents one command in this protocol (list or get) we will process it and return generated answer through the socket back to the Client. Function processCommand() parses the input line and if it recognizes LIST or GET command, calls corresponding (InfoData*)info methods - list and get, otherwise creates appropriate error message. -QSocket is a subclass of TQIODevice, thus we can use QTextStream to read and write lines to it. +QSocket is a subclass of TQIODevice, thus we can use TQTextStream to read and write lines to it. @@ -244,7 +244,7 @@ Because user connects to the server by request (btnConnect), connectToServer() d \printuntil os << \printline } -This function sends a command to the server. Notice that is uses QTextStream to send data via socket. +This function sends a command to the server. Notice that is uses TQTextStream to send data via socket. \skipto ::socketReadyRead diff --git a/doc/pictures.doc b/doc/pictures.doc index ceadeaa9..0ec1b24a 100644 --- a/doc/pictures.doc +++ b/doc/pictures.doc @@ -71,7 +71,7 @@ Below we present a \l QMainWindow which has a \l QMenuBar and some \l {QToolBar}s that contain various widgets, e.g. \l {QToolButton}s and \l {QComboBox}es. The central widget is a \l QWorkspace which is used for MDI window management and -which contains an MDI-Window featuring a \l QTextEdit. At the bottom +which contains an MDI-Window featuring a \l TQTextEdit. At the bottom you see a \l QStatusBar and at the bottom-right a \l QSizeGrip. \img mainwindow-w.png @@ -139,9 +139,9 @@ QLCDNumber. In the bottom row there are some \l {QPushButton}s. \img qtabdlg-w.png -In the screenshot below there's a \l QTextBrowser displaying a HTML -page. See also \l QTextEdit. +In the screenshot below there's a \l TQTextBrowser displaying a HTML +page. See also \l TQTextEdit. -\img qtextbrowser-w.png +\img tqtextbrowser-w.png */ diff --git a/doc/plugins-howto.doc b/doc/plugins-howto.doc index eedb536b..b7ab6445 100644 --- a/doc/plugins-howto.doc +++ b/doc/plugins-howto.doc @@ -70,7 +70,7 @@ by default in the standard plugin directory. \i \l QStylePlugin \i \c{pluginsbase/styles} <sup>*</sup> \row -\i \l QTextCodecPlugin +\i \l TQTextCodecPlugin \i \c{pluginsbase/codecs} <sup>*</sup> \row \i \l TQWidgetPlugin diff --git a/doc/porting3.doc b/doc/porting3.doc index 0500b4ee..e228e538 100644 --- a/doc/porting3.doc +++ b/doc/porting3.doc @@ -328,7 +328,7 @@ new code. \i QTabDialog::selected( const TQString \& ) \i QTabDialog::selected( const TQString \& tabLabel ) \i QTabDialog::setTabEnabled( const char *name, bool enable ) -\i QTextStream::QTextStream( TQString \& str, int filemode ) +\i TQTextStream::TQTextStream( TQString \& str, int filemode ) \i QToolBar::QToolBar( const TQString \& label, QMainWindow *, ToolBarDock = DockTop, bool newLine = FALSE, const char *name = 0 ) \i QToolTip::enabled() \i QToolTip::setEnabled( bool enable ) @@ -345,7 +345,7 @@ new code. \i TQWidget::setPalette( const QPalette \& p, bool ) \i QWizard::setFinish( TQWidget *, bool ) \i TQXmlInputSource::TQXmlInputSource( QFile \& file ) -\i TQXmlInputSource::TQXmlInputSource( QTextStream \& stream ) +\i TQXmlInputSource::TQXmlInputSource( TQTextStream \& stream ) \i TQXmlReader::parse( const TQXmlInputSource \& input ) \endlist @@ -466,17 +466,17 @@ top level widgets. The QMultiLineEdit was a simple editor widget in previous TQt versions. Since TQt 3.0 includes a new richtext engine, which also supports editing, QMultiLineEdit is obsolete. For the sake of compatibility -QMultiLineEdit is still provided. It is now a subclass of QTextEdit +QMultiLineEdit is still provided. It is now a subclass of TQTextEdit which wraps the old QMultiLineEdit so that it is mostly source compatible to keep old applications working. For new applications and when maintaining existing applications we -recommend that you use QTextEdit instead of QMultiLineEdit wherever +recommend that you use TQTextEdit instead of QMultiLineEdit wherever possible. Although most of the old QMultiLineEdit API is still available, there is one important difference. The old QMultiLineEdit operated in terms -of lines, whereas QTextEdit operates in terms of paragraphs. This is +of lines, whereas TQTextEdit operates in terms of paragraphs. This is because lines change all the time during wordwrap, whereas paragraphs remain paragraphs. The consequence of this change is that functions which previously operated on lines, e.g. numLines(), textLine(), etc., @@ -675,9 +675,9 @@ New code should use the following functions instead: \i QIconSet QToolButton::iconSet() const \endlist -\section1 QTextStream +\section1 TQTextStream -The global QTextStream manipulators setw(), setfill() and setprecison() +The global TQTextStream manipulators setw(), setfill() and setprecison() were renamed to qSetW(), qSetFill() and qSetPrecision() to avoid conflicts with \c <iostream.h>. If you used them, you must rename the occurrences to the new names. diff --git a/doc/qtl.doc b/doc/qtl.doc index ac366112..93affc2d 100644 --- a/doc/qtl.doc +++ b/doc/qtl.doc @@ -259,14 +259,14 @@ must be valid). For example: \section2 tqCopy() The tqCopy() template function copies a range of elements to an -OutputIterator, in this case a QTextOStreamIterator: +OutputIterator, in this case a TQTextOStreamIterator: \code TQValueList<int> list; list.push_back( 100 ); list.push_back( 200 ); list.push_back( 300 ); - QTextOStream str( stdout ); - tqCopy( list.begin(), list.end(), QTextOStreamIterator(str) ); + TQTextOStream str( stdout ); + tqCopy( list.begin(), list.end(), TQTextOStreamIterator(str) ); \endcode \omit @@ -331,8 +331,8 @@ a standard C++ array with tqCopy(): \code int arr[] = { 100, 200, 300 }; - QTextOStream str( stdout ); - tqCopy( arr, arr + 3, QTextOStreamIterator( str ) ); + TQTextOStream str( stdout ); + tqCopy( arr, arr + 3, TQTextOStreamIterator( str ) ); \endcode \section1 Streaming diff --git a/doc/tutorial2.doc b/doc/tutorial2.doc index 79818ebf..4f928034 100644 --- a/doc/tutorial2.doc +++ b/doc/tutorial2.doc @@ -232,7 +232,7 @@ index; (see \link debug.html Debugging\endlink). (Extracts from \c element.h.) \quotefile chart/element.h -\skipto QTextStream +\skipto TQTextStream \printline \printline @@ -250,7 +250,7 @@ filter the data using a scripting language. \printto const Our implementation of the operators requires the inclusion of \c -ntqtextstream.h and \c tqstringlist.h. +tqtextstream.h and \c tqstringlist.h. \printto Element diff --git a/doc/unicode.doc b/doc/unicode.doc index 405320d3..46122321 100644 --- a/doc/unicode.doc +++ b/doc/unicode.doc @@ -90,7 +90,7 @@ strings are stored using Unicode. TQt provides: \list \i Translation to/from legacy encodings for file I/O: see \l -QTextCodec and \l QTextStream. +TQTextCodec and \l TQTextStream. \i Translation from Input Methods and 8-bit keyboard input. \i Translation to legacy character sets for on-screen display. \i A string class, \l TQString, that stores Unicode characters, with @@ -105,7 +105,7 @@ even on Windows platforms that do not support it natively. To fully benefit from Unicode, we recommend using TQString for storing all user-visible strings, and performing all text file I/O using -QTextStream. Use \l QKeyEvent::text() for keyboard input in any custom +TQTextStream. Use \l QKeyEvent::text() for keyboard input in any custom widgets you write; it does not make much difference for slow typists in Western Europe or North America, but for fast typists or people using special input methods using text() is beneficial. @@ -127,7 +127,7 @@ tr() (simplifying somewhat) maps from \c{const char *} to a Unicode string, and uses installable \l QTranslator objects to do the mapping. -Qt provides a number of built-in \l QTextCodec classes, that is, +Qt provides a number of built-in \l TQTextCodec classes, that is, classes that know how to translate between Unicode and legacy encodings to support programs that must talk to other programs or read/write files in legacy file formats. diff --git a/examples/README b/examples/README index 05632097..454a9b68 100644 --- a/examples/README +++ b/examples/README @@ -297,7 +297,7 @@ regexptester This little application is useful for testing regular expressions. richtext - This example shows the use of QTextView (a read/only QTextEdit + This example shows the use of TQTextView (a read/only TQTextEdit subclass). rot13 @@ -368,7 +368,7 @@ tetrix work of art. textedit - A simple text editor based on QTextEdit. + A simple text editor based on TQTextEdit. themes This examples demonstrates how to draw widgets in different styles diff --git a/examples/action/application.cpp b/examples/action/application.cpp index 9fbf22e3..25822a3c 100644 --- a/examples/action/application.cpp +++ b/examples/action/application.cpp @@ -15,7 +15,7 @@ #include <ntqtoolbutton.h> #include <ntqpopupmenu.h> #include <ntqmenubar.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqfile.h> #include <ntqfiledialog.h> #include <ntqstatusbar.h> @@ -23,7 +23,7 @@ #include <ntqprinter.h> #include <ntqapplication.h> #include <ntqaccel.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqpainter.h> #include <ntqpaintdevicemetrics.h> #include <ntqwhatsthis.h> diff --git a/examples/addressbook/centralwidget.cpp b/examples/addressbook/centralwidget.cpp index 5b504850..e5a10147 100644 --- a/examples/addressbook/centralwidget.cpp +++ b/examples/addressbook/centralwidget.cpp @@ -19,7 +19,7 @@ #include <ntqlabel.h> #include <ntqcheckbox.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> ABCentralWidget::ABCentralWidget( TQWidget *parent, const char *name ) : TQWidget( parent, name ) diff --git a/examples/application/application.cpp b/examples/application/application.cpp index 32c291f0..e92bdddb 100644 --- a/examples/application/application.cpp +++ b/examples/application/application.cpp @@ -15,7 +15,7 @@ #include <ntqtoolbutton.h> #include <ntqpopupmenu.h> #include <ntqmenubar.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqfile.h> #include <ntqfiledialog.h> #include <ntqstatusbar.h> @@ -23,7 +23,7 @@ #include <ntqprinter.h> #include <ntqapplication.h> #include <ntqaccel.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqpainter.h> #include <ntqpaintdevicemetrics.h> #include <ntqwhatsthis.h> diff --git a/examples/chart/element.cpp b/examples/chart/element.cpp index 21826028..240a0eea 100644 --- a/examples/chart/element.cpp +++ b/examples/chart/element.cpp @@ -1,7 +1,7 @@ #include "element.h" #include <tqstringlist.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> const char FIELD_SEP = ':'; const char PROPOINT_SEP = ';'; diff --git a/examples/demo/frame.cpp b/examples/demo/frame.cpp index 1fed9f83..d243e714 100644 --- a/examples/demo/frame.cpp +++ b/examples/demo/frame.cpp @@ -21,7 +21,7 @@ #include <ntqsignalmapper.h> #include <ntqdict.h> #include <ntqdir.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <stdlib.h> #include <ntqbuttongroup.h> #include <ntqtoolbutton.h> diff --git a/examples/demo/i18n/i18n.cpp b/examples/demo/i18n/i18n.cpp index 53397659..053455ce 100644 --- a/examples/demo/i18n/i18n.cpp +++ b/examples/demo/i18n/i18n.cpp @@ -15,7 +15,7 @@ #include <ntqapplication.h> #include <tqwidgetlist.h> #include <ntqlabel.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> static int windowIdNumber = 5000; diff --git a/examples/demo/opengl/glinfotext.h b/examples/demo/opengl/glinfotext.h index 99142809..833a3dd3 100644 --- a/examples/demo/opengl/glinfotext.h +++ b/examples/demo/opengl/glinfotext.h @@ -1,5 +1,5 @@ #include <ntqlayout.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqfont.h> #include "glinfo.h" diff --git a/examples/demo/textdrawing/example.html b/examples/demo/textdrawing/example.html index bb4eb99d..dd62518b 100644 --- a/examples/demo/textdrawing/example.html +++ b/examples/demo/textdrawing/example.html @@ -103,7 +103,7 @@ the other widget (called the TQLabel's "buddy"). Example: (the <a href="ntqlineedit.html">TQLineEdit</a>) when the user presses <dfn>Alt-P.</dfn> You can also use the <a href="#191701">setBuddy</a>() function to accomplish the same. <p> -<p>See also <a href="ntqlineedit.html">TQLineEdit</a>, <a href="ntqtextview.html">TQTextView</a>, <a href="ntqpixmap.html">TQPixmap</a>, <a href="ntqmovie.html">TQMovie</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Label</a> +<p>See also <a href="ntqlineedit.html">TQLineEdit</a>, <a href="tqtextview.html">TQTextView</a>, <a href="ntqpixmap.html">TQPixmap</a>, <a href="ntqmovie.html">TQMovie</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Label</a> <p>Examples: <a href="cursor-cursor-cpp.html#TQLabel">cursor/cursor.cpp</a> <a href="layout-layout-cpp.html#TQLabel">layout/layout.cpp</a> @@ -294,7 +294,7 @@ the format of <em>text.</em> the buddy accelerator key is updated from the new text. <p>The label resizes itself if auto-resizing is enabled. <p>Note that Qlabel is well suited to display small rich text documents -only. For large documents, use <a href="ntqtextview.html">TQTextView</a> instead. It will flicker +only. For large documents, use <a href="tqtextview.html">TQTextView</a> instead. It will flicker less on resize and can also provide a scrollbar if necessary. <p>See also <a href="#72cf09">text</a>(), <a href="#5de3f9">setTextFormat</a>(), <a href="#191701">setBuddy</a>() and <a href="#1f406e">setAlignment</a>(). <p>Examples: diff --git a/examples/demo/textdrawing/helpwindow.cpp b/examples/demo/textdrawing/helpwindow.cpp index 55d1e588..a6fd6df6 100644 --- a/examples/demo/textdrawing/helpwindow.cpp +++ b/examples/demo/textdrawing/helpwindow.cpp @@ -16,7 +16,7 @@ #include <ntqtoolbutton.h> #include <ntqiconset.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqstylesheet.h> #include <ntqmessagebox.h> #include <ntqfiledialog.h> diff --git a/examples/demo/textdrawing/helpwindow.h b/examples/demo/textdrawing/helpwindow.h index 9f05d001..998cc17a 100644 --- a/examples/demo/textdrawing/helpwindow.h +++ b/examples/demo/textdrawing/helpwindow.h @@ -11,7 +11,7 @@ #define HELPWINDOW_H #include <ntqmainwindow.h> -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> #include <tqstringlist.h> #include <tqmap.h> #include <ntqdir.h> diff --git a/examples/demo/textdrawing/textedit.cpp b/examples/demo/textdrawing/textedit.cpp index 5e203ed1..b287fad4 100644 --- a/examples/demo/textdrawing/textedit.cpp +++ b/examples/demo/textdrawing/textedit.cpp @@ -9,7 +9,7 @@ #include "textedit.h" -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqaction.h> #include <ntqmenubar.h> #include <ntqpopupmenu.h> diff --git a/examples/fonts/simple-qfont-demo/viewer.cpp b/examples/fonts/simple-qfont-demo/viewer.cpp index 36628c40..88c202e3 100644 --- a/examples/fonts/simple-qfont-demo/viewer.cpp +++ b/examples/fonts/simple-qfont-demo/viewer.cpp @@ -2,7 +2,7 @@ #include "viewer.h" #include <tqstring.h> #include <tqstringlist.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqpushbutton.h> #include <ntqlayout.h> diff --git a/examples/helpviewer/helpwindow.cpp b/examples/helpviewer/helpwindow.cpp index 49a74efb..315ea62e 100644 --- a/examples/helpviewer/helpwindow.cpp +++ b/examples/helpviewer/helpwindow.cpp @@ -16,7 +16,7 @@ #include <ntqtoolbutton.h> #include <ntqiconset.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqstylesheet.h> #include <ntqmessagebox.h> #include <ntqfiledialog.h> diff --git a/examples/helpviewer/helpwindow.h b/examples/helpviewer/helpwindow.h index e912eaec..311b4ff4 100644 --- a/examples/helpviewer/helpwindow.h +++ b/examples/helpviewer/helpwindow.h @@ -11,7 +11,7 @@ #define HELPWINDOW_H #include <ntqmainwindow.h> -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> #include <tqstringlist.h> #include <tqmap.h> #include <ntqdir.h> diff --git a/examples/i18n/main.cpp b/examples/i18n/main.cpp index 8e8e8661..269115e9 100644 --- a/examples/i18n/main.cpp +++ b/examples/i18n/main.cpp @@ -17,7 +17,7 @@ #include <ntqbuttongroup.h> #include <ntqpushbutton.h> #include <ntqsignalmapper.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <stdlib.h> #if defined(Q_OS_UNIX) diff --git a/examples/mdi/application.cpp b/examples/mdi/application.cpp index 67e759b5..b7bb67cc 100644 --- a/examples/mdi/application.cpp +++ b/examples/mdi/application.cpp @@ -25,8 +25,8 @@ #include <ntqapplication.h> #include <ntqpushbutton.h> #include <ntqaccel.h> -#include <ntqtextstream.h> -#include <ntqtextedit.h> +#include <tqtextstream.h> +#include <tqtextedit.h> #include <ntqpainter.h> #include <ntqpaintdevicemetrics.h> #include <ntqwhatsthis.h> diff --git a/examples/network/clientserver/client/client.cpp b/examples/network/clientserver/client/client.cpp index aba0fef0..466867a9 100644 --- a/examples/network/clientserver/client/client.cpp +++ b/examples/network/clientserver/client/client.cpp @@ -11,11 +11,11 @@ #include <ntqapplication.h> #include <ntqvbox.h> #include <ntqhbox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqlineedit.h> #include <ntqlabel.h> #include <ntqpushbutton.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> class Client : public TQVBox diff --git a/examples/network/clientserver/server/server.cpp b/examples/network/clientserver/server/server.cpp index 3d974cb5..4a19f80b 100644 --- a/examples/network/clientserver/server/server.cpp +++ b/examples/network/clientserver/server/server.cpp @@ -11,10 +11,10 @@ #include <ntqserversocket.h> #include <ntqapplication.h> #include <ntqvbox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqlabel.h> #include <ntqpushbutton.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <stdlib.h> diff --git a/examples/network/httpd/httpd.cpp b/examples/network/httpd/httpd.cpp index 09942bcc..8f89b547 100644 --- a/examples/network/httpd/httpd.cpp +++ b/examples/network/httpd/httpd.cpp @@ -12,10 +12,10 @@ #include <ntqserversocket.h> #include <ntqapplication.h> #include <ntqmainwindow.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqvbox.h> #include <ntqlabel.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqpushbutton.h> // HttpDaemon is the the class that implements the simple HTTP server. diff --git a/examples/network/infoprotocol/infoclient/client.cpp b/examples/network/infoprotocol/infoclient/client.cpp index c1d05b6c..597099a6 100644 --- a/examples/network/infoprotocol/infoclient/client.cpp +++ b/examples/network/infoprotocol/infoclient/client.cpp @@ -9,11 +9,11 @@ #include <ntqsocket.h> #include <ntqapplication.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqlineedit.h> #include <ntqlabel.h> #include <ntqpushbutton.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqlistbox.h> #include "client.h" diff --git a/examples/network/infoprotocol/infoserver/server.cpp b/examples/network/infoprotocol/infoserver/server.cpp index d71de659..a651d38a 100644 --- a/examples/network/infoprotocol/infoserver/server.cpp +++ b/examples/network/infoprotocol/infoserver/server.cpp @@ -7,9 +7,9 @@ ** *****************************************************************************/ -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqpushbutton.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqapplication.h> #include <ntqmessagebox.h> #include <stdlib.h> diff --git a/examples/network/infoprotocol/infourlclient/client.cpp b/examples/network/infoprotocol/infourlclient/client.cpp index c3101639..ebe57437 100644 --- a/examples/network/infoprotocol/infourlclient/client.cpp +++ b/examples/network/infoprotocol/infourlclient/client.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #include <ntqapplication.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqpushbutton.h> #include <ntqfiledialog.h> diff --git a/examples/network/infoprotocol/infourlclient/qip.cpp b/examples/network/infoprotocol/infourlclient/qip.cpp index aed84838..87c209a4 100644 --- a/examples/network/infoprotocol/infourlclient/qip.cpp +++ b/examples/network/infoprotocol/infourlclient/qip.cpp @@ -10,7 +10,7 @@ #include <ntqsocket.h> #include <ntqurlinfo.h> #include <ntqurloperator.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include "qip.h" diff --git a/examples/network/mail/smtp.cpp b/examples/network/mail/smtp.cpp index e9a34b28..99d5d206 100644 --- a/examples/network/mail/smtp.cpp +++ b/examples/network/mail/smtp.cpp @@ -9,7 +9,7 @@ #include "smtp.h" -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqsocket.h> #include <ntqdns.h> #include <ntqtimer.h> diff --git a/examples/process/process.cpp b/examples/process/process.cpp index b235e18b..5eb16e15 100644 --- a/examples/process/process.cpp +++ b/examples/process/process.cpp @@ -10,7 +10,7 @@ #include <tqobject.h> #include <ntqprocess.h> #include <ntqvbox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqpushbutton.h> #include <ntqapplication.h> #include <ntqmessagebox.h> diff --git a/examples/qdir/qdir.cpp b/examples/qdir/qdir.cpp index b2cf108b..d6236e52 100644 --- a/examples/qdir/qdir.cpp +++ b/examples/qdir/qdir.cpp @@ -11,10 +11,10 @@ #include "ntqdir.h" #include <ntqapplication.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqfileinfo.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqhbox.h> #include <ntqspinbox.h> #include <ntqlabel.h> @@ -26,7 +26,7 @@ #include <ntqpushbutton.h> #include <ntqtoolbutton.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqtooltip.h> #include <stdlib.h> diff --git a/examples/qwerty/qwerty.cpp b/examples/qwerty/qwerty.cpp index 928fd27a..74758db2 100644 --- a/examples/qwerty/qwerty.cpp +++ b/examples/qwerty/qwerty.cpp @@ -12,14 +12,14 @@ #include <ntqfile.h> #include <ntqfiledialog.h> #include <ntqpopupmenu.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqpainter.h> #include <ntqmessagebox.h> #include <ntqpaintdevicemetrics.h> #include <tqptrlist.h> #include <ntqfontdialog.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> const bool no_writing = FALSE; diff --git a/examples/richtext/richtext.cpp b/examples/richtext/richtext.cpp index b166017a..ea958913 100644 --- a/examples/richtext/richtext.cpp +++ b/examples/richtext/richtext.cpp @@ -12,7 +12,7 @@ #include <ntqhbox.h> #include <ntqhbox.h> #include <ntqpushbutton.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqbrush.h> #include <ntqapplication.h> diff --git a/examples/textedit/textedit.cpp b/examples/textedit/textedit.cpp index fdc6402f..a814e6cc 100644 --- a/examples/textedit/textedit.cpp +++ b/examples/textedit/textedit.cpp @@ -9,7 +9,7 @@ #include "textedit.h" -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqaction.h> #include <ntqmenubar.h> #include <ntqpopupmenu.h> diff --git a/examples/thread/prodcons/prodcons.cpp b/examples/thread/prodcons/prodcons.cpp index 2716378c..d8cb4311 100644 --- a/examples/thread/prodcons/prodcons.cpp +++ b/examples/thread/prodcons/prodcons.cpp @@ -10,7 +10,7 @@ #include <ntqevent.h> #include <ntqlabel.h> #include <ntqcstring.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqfile.h> #include <stdio.h> diff --git a/examples/widgets/widgets.cpp b/examples/widgets/widgets.cpp index 8ea7e0ca..40f4056d 100644 --- a/examples/widgets/widgets.cpp +++ b/examples/widgets/widgets.cpp @@ -43,7 +43,7 @@ #include <ntqsplitter.h> #include <ntqlistview.h> #include <ntqheader.h> -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> #include <ntqfiledialog.h> #include <ntqaccel.h> #include <ntqmetaobject.h> diff --git a/extensions/nsplugin/examples/grapher/grapher.cpp b/extensions/nsplugin/examples/grapher/grapher.cpp index bbf24ba7..d29afab8 100644 --- a/extensions/nsplugin/examples/grapher/grapher.cpp +++ b/extensions/nsplugin/examples/grapher/grapher.cpp @@ -3,7 +3,7 @@ // Include other TQt classes. #include <ntqpainter.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqbuffer.h> #include <ntqpixmap.h> #include <ntqmenubar.h> diff --git a/include/ntqtextbrowser.h b/include/ntqtextbrowser.h deleted file mode 120000 index a4b7df78..00000000 --- a/include/ntqtextbrowser.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqtextbrowser.h \ No newline at end of file diff --git a/include/ntqtextcodec.h b/include/ntqtextcodec.h deleted file mode 120000 index 66d2a343..00000000 --- a/include/ntqtextcodec.h +++ /dev/null @@ -1 +0,0 @@ -../src/codecs/ntqtextcodec.h \ No newline at end of file diff --git a/include/ntqtextcodecfactory.h b/include/ntqtextcodecfactory.h deleted file mode 120000 index 8291d10c..00000000 --- a/include/ntqtextcodecfactory.h +++ /dev/null @@ -1 +0,0 @@ -../src/codecs/ntqtextcodecfactory.h \ No newline at end of file diff --git a/include/ntqtextcodecplugin.h b/include/ntqtextcodecplugin.h deleted file mode 120000 index cc09adfc..00000000 --- a/include/ntqtextcodecplugin.h +++ /dev/null @@ -1 +0,0 @@ -../src/codecs/ntqtextcodecplugin.h \ No newline at end of file diff --git a/include/ntqtextedit.h b/include/ntqtextedit.h deleted file mode 120000 index 1b53db04..00000000 --- a/include/ntqtextedit.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqtextedit.h \ No newline at end of file diff --git a/include/ntqtextstream.h b/include/ntqtextstream.h deleted file mode 120000 index 712fd369..00000000 --- a/include/ntqtextstream.h +++ /dev/null @@ -1 +0,0 @@ -../src/tools/ntqtextstream.h \ No newline at end of file diff --git a/include/ntqtextview.h b/include/ntqtextview.h deleted file mode 120000 index 634c9af6..00000000 --- a/include/ntqtextview.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqtextview.h \ No newline at end of file diff --git a/include/private/qtextcodecinterface_p.h b/include/private/qtextcodecinterface_p.h deleted file mode 120000 index 2eef1644..00000000 --- a/include/private/qtextcodecinterface_p.h +++ /dev/null @@ -1 +0,0 @@ -../../src/codecs/qtextcodecinterface_p.h \ No newline at end of file diff --git a/include/private/qtextengine_p.h b/include/private/qtextengine_p.h deleted file mode 120000 index b06b983d..00000000 --- a/include/private/qtextengine_p.h +++ /dev/null @@ -1 +0,0 @@ -../../src/kernel/qtextengine_p.h \ No newline at end of file diff --git a/include/private/qtextlayout_p.h b/include/private/qtextlayout_p.h deleted file mode 120000 index 39b5b165..00000000 --- a/include/private/qtextlayout_p.h +++ /dev/null @@ -1 +0,0 @@ -../../src/kernel/qtextlayout_p.h \ No newline at end of file diff --git a/include/private/tqtextcodecinterface_p.h b/include/private/tqtextcodecinterface_p.h new file mode 120000 index 00000000..75a7a51e --- /dev/null +++ b/include/private/tqtextcodecinterface_p.h @@ -0,0 +1 @@ +../../src/codecs/tqtextcodecinterface_p.h \ No newline at end of file diff --git a/include/private/tqtextengine_p.h b/include/private/tqtextengine_p.h new file mode 120000 index 00000000..357fe976 --- /dev/null +++ b/include/private/tqtextengine_p.h @@ -0,0 +1 @@ +../../src/kernel/tqtextengine_p.h \ No newline at end of file diff --git a/include/private/tqtextlayout_p.h b/include/private/tqtextlayout_p.h new file mode 120000 index 00000000..bf9dc49b --- /dev/null +++ b/include/private/tqtextlayout_p.h @@ -0,0 +1 @@ +../../src/kernel/tqtextlayout_p.h \ No newline at end of file diff --git a/include/tqtextbrowser.h b/include/tqtextbrowser.h new file mode 120000 index 00000000..17033974 --- /dev/null +++ b/include/tqtextbrowser.h @@ -0,0 +1 @@ +../src/widgets/tqtextbrowser.h \ No newline at end of file diff --git a/include/tqtextcodec.h b/include/tqtextcodec.h new file mode 120000 index 00000000..e0da5c1f --- /dev/null +++ b/include/tqtextcodec.h @@ -0,0 +1 @@ +../src/codecs/tqtextcodec.h \ No newline at end of file diff --git a/include/tqtextcodecfactory.h b/include/tqtextcodecfactory.h new file mode 120000 index 00000000..5537fd0d --- /dev/null +++ b/include/tqtextcodecfactory.h @@ -0,0 +1 @@ +../src/codecs/tqtextcodecfactory.h \ No newline at end of file diff --git a/include/tqtextcodecplugin.h b/include/tqtextcodecplugin.h new file mode 120000 index 00000000..59d41cbb --- /dev/null +++ b/include/tqtextcodecplugin.h @@ -0,0 +1 @@ +../src/codecs/tqtextcodecplugin.h \ No newline at end of file diff --git a/include/tqtextedit.h b/include/tqtextedit.h new file mode 120000 index 00000000..cc252596 --- /dev/null +++ b/include/tqtextedit.h @@ -0,0 +1 @@ +../src/widgets/tqtextedit.h \ No newline at end of file diff --git a/include/tqtextstream.h b/include/tqtextstream.h new file mode 120000 index 00000000..403f8a5c --- /dev/null +++ b/include/tqtextstream.h @@ -0,0 +1 @@ +../src/tools/tqtextstream.h \ No newline at end of file diff --git a/include/tqtextview.h b/include/tqtextview.h new file mode 120000 index 00000000..f2f0d5b9 --- /dev/null +++ b/include/tqtextview.h @@ -0,0 +1 @@ +../src/widgets/tqtextview.h \ No newline at end of file diff --git a/plugins/src/accessible/widgets/qaccessiblewidget.cpp b/plugins/src/accessible/widgets/qaccessiblewidget.cpp index d4846c93..518952fe 100644 --- a/plugins/src/accessible/widgets/qaccessiblewidget.cpp +++ b/plugins/src/accessible/widgets/qaccessiblewidget.cpp @@ -25,7 +25,7 @@ #include <ntqlistbox.h> #include <ntqlistview.h> #include <ntqiconview.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <tqwidgetstack.h> #include <private/qtitlebar_p.h> diff --git a/plugins/src/codecs/cn/main.cpp b/plugins/src/codecs/cn/main.cpp index b5a7f2cf..3470f076 100644 --- a/plugins/src/codecs/cn/main.cpp +++ b/plugins/src/codecs/cn/main.cpp @@ -1,5 +1,5 @@ -#include <ntqtextcodecplugin.h> -#include <ntqtextcodec.h> +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> #include <tqptrlist.h> #include <ntqapplication.h> diff --git a/plugins/src/codecs/jp/main.cpp b/plugins/src/codecs/jp/main.cpp index e8de7fef..9ec28a21 100644 --- a/plugins/src/codecs/jp/main.cpp +++ b/plugins/src/codecs/jp/main.cpp @@ -1,5 +1,5 @@ -#include <ntqtextcodecplugin.h> -#include <ntqtextcodec.h> +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> #include <tqptrlist.h> #include <ntqeucjpcodec.h> diff --git a/plugins/src/codecs/kr/main.cpp b/plugins/src/codecs/kr/main.cpp index 72f0b5cd..8f533df0 100644 --- a/plugins/src/codecs/kr/main.cpp +++ b/plugins/src/codecs/kr/main.cpp @@ -1,5 +1,5 @@ -#include <ntqtextcodecplugin.h> -#include <ntqtextcodec.h> +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> #include <tqptrlist.h> #include <ntqeuckrcodec.h> diff --git a/plugins/src/codecs/tw/main.cpp b/plugins/src/codecs/tw/main.cpp index 0e8ec6a5..c86c904f 100644 --- a/plugins/src/codecs/tw/main.cpp +++ b/plugins/src/codecs/tw/main.cpp @@ -1,5 +1,5 @@ -#include <ntqtextcodecplugin.h> -#include <ntqtextcodec.h> +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> #include <tqptrlist.h> #include <ntqbig5codec.h> diff --git a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp index 8f8bcdde..db9109a8 100644 --- a/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp +++ b/plugins/src/inputmethods/xim/qximinputcontext_x11.cpp @@ -50,7 +50,7 @@ const int XKeyRelease = KeyRelease; #include "tqstring.h" #include "tqptrlist.h" #include "ntqintdict.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include <stdlib.h> #include <limits.h> diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 4b772cb4..eeeb1cdc 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -5,7 +5,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o msvc_nmake.o msvc_objectmodel.o meta.o qtmd5.o #qt code -QOBJS=tqstring.o qtextstream.o qiodevice.o qglobal.o qgdict.o qcstring.o \ +QOBJS=tqstring.o tqtextstream.o qiodevice.o qglobal.o qgdict.o qcstring.o \ qdatastream.o qgarray.o qbuffer.o qglist.o tqptrcollection.o qfile.o \ qfile_unix.o qregexp.o qgvector.o qgcache.o qbitarray.o qdir.o quuid.o \ qfileinfo_unix.o qdir_unix.o qfileinfo.o qdatetime.o tqstringlist.o tqmap.o \ @@ -16,7 +16,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp qtmd5.cpp generators/makef generators/unix/unixmake.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ generators/win32/winmakefile.cpp generators/projectgenerator.cpp generators/mac/metrowerks_xml.cpp \ generators/mac/pbuilder_pbx.cpp generators/win32/msvc_objectmodel.cpp \ - @SOURCE_PATH@/src/tools/tqstring.cpp @SOURCE_PATH@/src/tools/qtextstream.cpp \ + @SOURCE_PATH@/src/tools/tqstring.cpp @SOURCE_PATH@/src/tools/tqtextstream.cpp \ @SOURCE_PATH@/src/tools/qiodevice.cpp @SOURCE_PATH@/src/tools/qglobal.cpp \ @SOURCE_PATH@/src/tools/qgdict.cpp @SOURCE_PATH@/src/tools/qcstring.cpp \ @SOURCE_PATH@/src/tools/qdatastream.cpp @SOURCE_PATH@/src/tools/qgarray.cpp \ @@ -60,8 +60,8 @@ depend: makedepend $(CXXFLAGS) -D__MAKEDEPEND__ $(DEPEND_SRC) # don't use optimization for these -qtextstream.o: @SOURCE_PATH@/src/tools/qtextstream.cpp - $(CXX) -c -o $@ $(CXXFLAGS) @SOURCE_PATH@/src/tools/qtextstream.cpp +tqtextstream.o: @SOURCE_PATH@/src/tools/tqtextstream.cpp + $(CXX) -c -o $@ $(CXXFLAGS) @SOURCE_PATH@/src/tools/tqtextstream.cpp qiodevice.o: @SOURCE_PATH@/src/tools/qiodevice.cpp $(CXX) -c -o $@ $(CXXFLAGS) @SOURCE_PATH@/src/tools/qiodevice.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 64ffb38c..19d79120 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -19,7 +19,7 @@ OBJS=project.o main.o makefile.o unixmake.o unixmake2.o borland_bmake.o mingw_ma metrowerks_xml.o pbuilder_pbx.o msvc_objectmodel.o property.o meta.o qtmd5.o #qt code -QTOBJS=tqstring.o quuid.o qtextstream.o qiodevice.o qglobal.o qgdict.o qcstring.o qdatastream.o \ +QTOBJS=tqstring.o quuid.o tqtextstream.o qiodevice.o qglobal.o qgdict.o qcstring.o qdatastream.o \ qgarray.o qbuffer.o qglist.o tqptrcollection.o qfile.o qfile_win.o qregexp.o qgvector.o \ qgcache.o qbitarray.o qdir.o qfileinfo_win.o qdir_win.o qfileinfo.o qdatetime.o \ tqstringlist.o tqmap.o qlibrary.o qlibrary_win.o qconfig.o qsettings.o qsettings_win.o qunicodetables.o \ @@ -52,8 +52,8 @@ qlibrary.o: ..\src\tools\qlibrary.cpp qlibrary_win.o: ..\src\tools\qlibrary_win.cpp $(CXX) $(CXXFLAGS) ..\src\tools\qlibrary_win.cpp -qtextstream.o: ..\src\tools\qtextstream.cpp - $(CXX) $(CXXFLAGS) ..\src\tools\qtextstream.cpp +tqtextstream.o: ..\src\tools\tqtextstream.cpp + $(CXX) $(CXXFLAGS) ..\src\tools\tqtextstream.cpp qiodevice.o: ..\src\tools\qiodevice.cpp $(CXX) $(CXXFLAGS) ..\src\tools\qiodevice.cpp @@ -97,8 +97,8 @@ qfile.o: ..\src\tools\qfile.cpp qfile_win.o: ..\src\tools\qfile_win.cpp $(CXX) $(CXXFLAGS) ..\src\tools\qfile_win.cpp -qtextcodec.o: ..\src\codecs\qtextcodec.cpp - $(CXX) $(CXXFLAGS) ..\src\codecs\qtextcodec.cpp +tqtextcodec.o: ..\src\codecs\tqtextcodec.cpp + $(CXX) $(CXXFLAGS) ..\src\codecs\tqtextcodec.cpp qregexp.o: ..\src\tools\qregexp.cpp $(CXX) $(CXXFLAGS) ..\src\tools\qregexp.cpp diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index aa3f6c61..be91529d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -41,7 +41,7 @@ #include "meta.h" #include <ntqdir.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqregexp.h> #include <ntqdict.h> #if defined(Q_OS_UNIX) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 79659507..763b57ab 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -40,7 +40,7 @@ #include "option.h" #include "project.h" -#include <ntqtextstream.h> +#include <tqtextstream.h> #ifdef Q_OS_WIN32 #define QT_POPEN _popen diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index da327f74..fcc7672f 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -38,7 +38,7 @@ #include "msvc_objectmodel.h" #include "msvc_vcproj.h" -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqstringlist.h> #include <ntqfileinfo.h> diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index be38541b..e08a814b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -40,7 +40,7 @@ #include "option.h" #include "project.h" #include "meta.h" -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqstring.h> #include <ntqdict.h> #include <ntqregexp.h> diff --git a/qmake/project.cpp b/qmake/project.cpp index 9f13f85f..d17ad751 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -42,7 +42,7 @@ #include <ntqfile.h> #include <ntqdir.h> #include <ntqregexp.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqvaluestack.h> #ifdef Q_OS_UNIX # include <unistd.h> diff --git a/src/codecs/ntqbig5codec.h b/src/codecs/ntqbig5codec.h index 73039967..d2f1f7c8 100644 --- a/src/codecs/ntqbig5codec.h +++ b/src/codecs/ntqbig5codec.h @@ -46,7 +46,7 @@ #define TQBIG5CODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_BIG_CODECS diff --git a/src/codecs/ntqeucjpcodec.h b/src/codecs/ntqeucjpcodec.h index 6ccbcddb..39b76866 100644 --- a/src/codecs/ntqeucjpcodec.h +++ b/src/codecs/ntqeucjpcodec.h @@ -71,7 +71,7 @@ #define TQEUCJPCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqjpunicode.h" #endif // QT_H diff --git a/src/codecs/ntqeuckrcodec.h b/src/codecs/ntqeuckrcodec.h index fcd97a96..513c85f0 100644 --- a/src/codecs/ntqeuckrcodec.h +++ b/src/codecs/ntqeuckrcodec.h @@ -67,7 +67,7 @@ #define TQEUCKRCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_BIG_CODECS diff --git a/src/codecs/ntqgb18030codec.h b/src/codecs/ntqgb18030codec.h index 676a08a1..c28c6222 100644 --- a/src/codecs/ntqgb18030codec.h +++ b/src/codecs/ntqgb18030codec.h @@ -42,7 +42,7 @@ #define TQGB18030CODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H diff --git a/src/codecs/ntqjiscodec.h b/src/codecs/ntqjiscodec.h index b96d0aec..3e914f48 100644 --- a/src/codecs/ntqjiscodec.h +++ b/src/codecs/ntqjiscodec.h @@ -71,7 +71,7 @@ #define TQJISCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqjpunicode.h" #endif // QT_H diff --git a/src/codecs/ntqrtlcodec.h b/src/codecs/ntqrtlcodec.h index f4016125..bbd990df 100644 --- a/src/codecs/ntqrtlcodec.h +++ b/src/codecs/ntqrtlcodec.h @@ -42,7 +42,7 @@ #define TQRTLCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_CODEC_HEBREW diff --git a/src/codecs/ntqsjiscodec.h b/src/codecs/ntqsjiscodec.h index a1acc053..8a5f83aa 100644 --- a/src/codecs/ntqsjiscodec.h +++ b/src/codecs/ntqsjiscodec.h @@ -71,7 +71,7 @@ #define TQSJISCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqjpunicode.h" #endif // QT_H diff --git a/src/codecs/ntqtextcodec.h b/src/codecs/ntqtextcodec.h deleted file mode 100644 index f5554d26..00000000 --- a/src/codecs/ntqtextcodec.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Definition of TQTextCodec class -** -** Created : 981015 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTCODEC_H -#define TQTEXTCODEC_H - -#ifndef QT_H -#include "tqstring.h" -#endif // QT_H - -#ifndef TQT_NO_TEXTCODEC - -class TQTextCodec; -class TQIODevice; -class TQFont; - -class TQ_EXPORT TQTextEncoder { -public: - virtual ~TQTextEncoder(); - virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) = 0; -}; - -class TQ_EXPORT TQTextDecoder { -public: - virtual ~TQTextDecoder(); - virtual TQString toUnicode(const char* chars, int len) = 0; -}; - -class TQ_EXPORT TQTextCodec { -public: - virtual ~TQTextCodec(); - -#ifndef TQT_NO_CODECS - static TQTextCodec* loadCharmap(TQIODevice*); - static TQTextCodec* loadCharmapFile(TQString filename); -#endif //TQT_NO_CODECS - static TQTextCodec* codecForMib(int mib); - static TQTextCodec* codecForName(const char* hint, int accuracy=0); - static TQTextCodec* codecForContent(const char* chars, int len); - static TQTextCodec* codecForIndex(int i); - static TQTextCodec* codecForLocale(); - static void setCodecForLocale(TQTextCodec *c); - - static TQTextCodec* codecForTr(); - static void setCodecForTr(TQTextCodec *c); - static TQTextCodec* codecForCStrings(); - static void setCodecForCStrings(TQTextCodec *c); - - static void deleteAllCodecs(); - - static const char* locale(); - - virtual const char* name() const = 0; - virtual const char* mimeName() const; - virtual int mibEnum() const = 0; - - virtual TQTextDecoder* makeDecoder() const; - virtual TQTextEncoder* makeEncoder() const; - - virtual TQString toUnicode(const char* chars, int len) const; - virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) const; - - TQCString fromUnicode(const TQString& uc) const; - TQString toUnicode(const TQByteArray&, int len) const; - TQString toUnicode(const TQByteArray&) const; - TQString toUnicode(const TQCString&, int len) const; - TQString toUnicode(const TQCString&) const; - TQString toUnicode(const char* chars) const; - virtual bool canEncode( TQChar ) const; - virtual bool canEncode( const TQString& ) const; - - virtual int heuristicContentMatch(const char* chars, int len) const = 0; - virtual int heuristicNameMatch(const char* hint) const; - - virtual TQByteArray fromUnicode(const TQString& uc, int from, int len) const; - virtual unsigned short characterFromUnicode(const TQString &str, int pos) const; - -protected: - TQTextCodec(); - static int simpleHeuristicNameMatch(const char* name, const char* hint); - -private: - friend class TQFont; - friend class TQFontEngineXLFD; - void fromUnicodeInternal( const TQChar *in, unsigned short *out, int length ); - - static TQTextCodec *cftr; - static TQTextCodec *cfcs; -}; - -inline TQTextCodec* TQTextCodec::codecForTr() { return cftr; } -inline void TQTextCodec::setCodecForTr(TQTextCodec *c) { cftr = c; } -inline TQTextCodec* TQTextCodec::codecForCStrings() { return cfcs; } -inline void TQTextCodec::setCodecForCStrings(TQTextCodec *c) { cfcs = c; } - -#endif // TQT_NO_TEXTCODEC -#endif // TQTEXTCODEC_H diff --git a/src/codecs/ntqtextcodecfactory.h b/src/codecs/ntqtextcodecfactory.h deleted file mode 100644 index 74cca82c..00000000 --- a/src/codecs/ntqtextcodecfactory.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Definition of TQTextCodecFactory class -** -** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTCODECFACTORY_H -#define TQTEXTCODECFACTORY_H - -#ifndef QT_H -#include "tqstringlist.h" -#endif // QT_H - -#ifndef TQT_NO_TEXTCODEC - -class TQTextCodec; - -class TQ_EXPORT TQTextCodecFactory -{ -public: - static TQTextCodec *createForName( const TQString & ); - static TQTextCodec *createForMib( int ); -}; - -#endif // TQT_NO_TEXTCODEC - -#endif // TQTEXTCODECFACTORY_H diff --git a/src/codecs/ntqtextcodecplugin.h b/src/codecs/ntqtextcodecplugin.h deleted file mode 100644 index 13a83733..00000000 --- a/src/codecs/ntqtextcodecplugin.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Definition of TQTextCodecPlugin class -** -** Created : 010920 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTCODECPLUGIN_H -#define TQTEXTCODECPLUGIN_H - -#ifndef QT_H -#include "ntqgplugin.h" -#include "tqstringlist.h" -#endif // QT_H - -#ifndef TQT_NO_TEXTCODECPLUGIN -class TQTextCodec; -class TQTextCodecPluginPrivate; - -class TQ_EXPORT TQTextCodecPlugin : public TQGPlugin -{ - TQ_OBJECT -public: - TQTextCodecPlugin(); - ~TQTextCodecPlugin(); - - virtual TQStringList names() const = 0; - virtual TQTextCodec *createForName( const TQString &name ) = 0; - - virtual TQValueList<int> mibEnums() const = 0; - virtual TQTextCodec *createForMib( int mib ) = 0; - -private: - TQTextCodecPluginPrivate *d; -}; -#endif // TQT_NO_TEXTCODECPLUGIN -#endif // TQTEXTCODECPLUGIN_H diff --git a/src/codecs/ntqtsciicodec.h b/src/codecs/ntqtsciicodec.h index bbea40f2..a71a3fe9 100644 --- a/src/codecs/ntqtsciicodec.h +++ b/src/codecs/ntqtsciicodec.h @@ -69,7 +69,7 @@ #define TQTSCIICODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_CODECS diff --git a/src/codecs/ntqutfcodec.h b/src/codecs/ntqutfcodec.h index c6303a3c..c763238c 100644 --- a/src/codecs/ntqutfcodec.h +++ b/src/codecs/ntqutfcodec.h @@ -42,7 +42,7 @@ #define TQUTFCODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_TEXTCODEC diff --git a/src/codecs/qfontcodecs_p.h b/src/codecs/qfontcodecs_p.h index cc2cd40b..b9ba7ebd 100644 --- a/src/codecs/qfontcodecs_p.h +++ b/src/codecs/qfontcodecs_p.h @@ -55,7 +55,7 @@ #ifndef QT_H #include "ntqglobal.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H diff --git a/src/codecs/qisciicodec_p.h b/src/codecs/qisciicodec_p.h index 2fe0a115..372415cf 100644 --- a/src/codecs/qisciicodec_p.h +++ b/src/codecs/qisciicodec_p.h @@ -2,7 +2,7 @@ #define TQISCIICODEC_H #ifndef QT_H -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif // QT_H #ifndef TQT_NO_CODECS diff --git a/src/codecs/qrtlcodec.cpp b/src/codecs/qrtlcodec.cpp index f4e471b0..de377f53 100644 --- a/src/codecs/qrtlcodec.cpp +++ b/src/codecs/qrtlcodec.cpp @@ -39,7 +39,7 @@ **********************************************************************/ #include "ntqrtlcodec.h" -#include <private/qtextengine_p.h> +#include <private/tqtextengine_p.h> #ifndef TQT_NO_CODEC_HEBREW diff --git a/src/codecs/qt_codecs.pri b/src/codecs/qt_codecs.pri index 196448d3..80ec0c22 100644 --- a/src/codecs/qt_codecs.pri +++ b/src/codecs/qt_codecs.pri @@ -14,12 +14,12 @@ tools { $$CODECS_H/ntqjpunicode.h \ $$CODECS_H/ntqrtlcodec.h \ $$CODECS_H/ntqsjiscodec.h \ - $$CODECS_H/ntqtextcodec.h \ + $$CODECS_H/tqtextcodec.h \ $$CODECS_H/ntqtsciicodec.h \ $$CODECS_H/ntqutfcodec.h \ - $$CODECS_P/qtextcodecinterface_p.h \ - $$CODECS_H/ntqtextcodecfactory.h \ - $$CODECS_H/ntqtextcodecplugin.h + $$CODECS_P/tqtextcodecinterface_p.h \ + $$CODECS_H/tqtextcodecfactory.h \ + $$CODECS_H/tqtextcodecplugin.h SOURCES += \ #$$CODECS_CPP/qasmocodec.cpp \ @@ -32,11 +32,11 @@ tools { $$CODECS_CPP/qjpunicode.cpp \ $$CODECS_CPP/qrtlcodec.cpp \ $$CODECS_CPP/qsjiscodec.cpp \ - $$CODECS_CPP/qtextcodec.cpp \ + $$CODECS_CPP/tqtextcodec.cpp \ $$CODECS_CPP/qtsciicodec.cpp \ $$CODECS_CPP/qutfcodec.cpp \ - $$CODECS_CPP/qtextcodecfactory.cpp \ - $$CODECS_CPP/qtextcodecplugin.cpp + $$CODECS_CPP/tqtextcodecfactory.cpp \ + $$CODECS_CPP/tqtextcodecplugin.cpp x11:SOURCES += $$CODECS_CPP/qfontcncodec.cpp \ $$CODECS_CPP/qfonthkcodec.cpp \ diff --git a/src/codecs/qtextcodec.cpp b/src/codecs/qtextcodec.cpp deleted file mode 100644 index 632dface..00000000 --- a/src/codecs/qtextcodec.cpp +++ /dev/null @@ -1,3161 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQTextCodec class -** -** Created : 981015 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "qplatformdefs.h" - -// UNIX Large File Support redefines open -> open64 -#if defined(open) -# undef open -#endif - -#include "ntqtextcodec.h" -#ifndef TQT_NO_TEXTCODEC - -#include "tqvaluelist.h" -#include "ntqtextcodecfactory.h" -#include "ntqutfcodec.h" -#include "ntqnamespace.h" -#ifndef TQT_NO_CODECS -#include "ntqrtlcodec.h" -#include "ntqtsciicodec.h" -#include "qisciicodec_p.h" -#endif // TQT_NO_CODECS -#ifndef TQT_NO_BIG_CODECS -#include "ntqbig5codec.h" -#include "ntqeucjpcodec.h" -#include "ntqeuckrcodec.h" -#include "ntqgb18030codec.h" -#include "ntqjiscodec.h" -#include "ntqjpunicode.h" -#include "ntqsjiscodec.h" -#endif // TQT_NO_BIG_CODECS -#include "ntqfile.h" -#include "tqstrlist.h" -#include "tqstring.h" -#include "../tools/qlocale_p.h" - -#if !defined(TQT_NO_CODECS) && !defined(TQT_NO_BIG_CODECS) && defined(TQ_WS_X11) -# include "qfontcodecs_p.h" -#endif - -#ifdef TQT_THREAD_SUPPORT -# include <private/qmutexpool_p.h> -#endif // TQT_THREAD_SUPPORT - -#include <stdlib.h> -#include <ctype.h> -#ifndef Q_OS_TEMP -#include <locale.h> -#endif -#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX6) -#include <langinfo.h> -#endif - -static TQValueList<TQTextCodec*> *all = 0; -static bool codecs_destroyed = false; -static TQTextCodec * localeMapper = 0; - -class TQTextCodecCleanup { -public: - ~TQTextCodecCleanup() { - TQTextCodec::deleteAllCodecs(); - } -}; -static TQTextCodecCleanup qtextcodec_cleanup; - -/*! - Deletes all the created codecs. - - \warning Do not call this function. - - TQApplication calls this function just before exiting to delete - any TQTextCodec objects that may be lying around. Since various - other classes hold pointers to TQTextCodec objects, it is not safe - to call this function earlier. - - If you are using the utility classes (like TQString) but not using - TQApplication, calling this function at the very end of your - application may be helpful for chasing down memory leaks by - eliminating any TQTextCodec objects. -*/ - -void TQTextCodec::deleteAllCodecs() -{ - codecs_destroyed = true; - - if ( !all ) - return; - -#ifdef TQT_THREAD_SUPPORT - TQMutexLocker locker( tqt_global_mutexpool ? - tqt_global_mutexpool->get( &all ) : 0 ); -#endif // TQT_THREAD_SUPPORT - - TQValueList<TQTextCodec*> *ball = all; - all = 0; - TQValueList<TQTextCodec*>::Iterator it; - for ( it = ball->begin(); it != ball->end(); ++it ) { - delete *it; - *it = 0; - } - ball->clear(); - delete ball; - - localeMapper = 0; -} - -static void setup(); - -class TQTextStatelessEncoder: public TQTextEncoder { - const TQTextCodec* codec; -public: - TQTextStatelessEncoder(const TQTextCodec*); - TQCString fromUnicode(const TQString& uc, int& lenInOut); -}; - - -class TQTextStatelessDecoder : public TQTextDecoder { - const TQTextCodec* codec; -public: - TQTextStatelessDecoder(const TQTextCodec*); - TQString toUnicode(const char* chars, int len); -}; - -TQTextStatelessEncoder::TQTextStatelessEncoder(const TQTextCodec* c) : - codec(c) -{ -} - - -TQCString TQTextStatelessEncoder::fromUnicode(const TQString& uc, int& lenInOut) -{ - return codec->fromUnicode(uc,lenInOut); -} - - -TQTextStatelessDecoder::TQTextStatelessDecoder(const TQTextCodec* c) : - codec(c) -{ -} - - -TQString TQTextStatelessDecoder::toUnicode(const char* chars, int len) -{ - return codec->toUnicode(chars,len); -} - - - -/*! - \class TQTextCodec ntqtextcodec.h - \brief The TQTextCodec class provides conversion between text encodings. - \reentrant - \ingroup i18n - - TQt uses Unicode to store, draw and manipulate strings. In many - situations you may wish to deal with data that uses a different - encoding. For example, most Japanese documents are still stored in - Shift-JIS or ISO2022, while Russian users often have their - documents in KOI8-R or CP1251. - - TQt provides a set of TQTextCodec classes to help with converting - non-Unicode formats to and from Unicode. You can also create your - own codec classes (\link #subclassing see later\endlink). - - The supported encodings are: - \list - \i Latin1 - \i Big5 -- Chinese - \i Big5-HKSCS -- Chinese - \i eucJP -- Japanese - \i eucKR -- Korean - \i GB2312 -- Chinese - \i GBK -- Chinese - \i GB18030 -- Chinese - \i JIS7 -- Japanese - \i Shift-JIS -- Japanese - \i TSCII -- Tamil - \i utf8 -- Unicode, 8-bit - \i utf16 -- Unicode - \i KOI8-R -- Russian - \i KOI8-U -- Ukrainian - \i ISO8859-1 -- Western - \i ISO8859-2 -- Central European - \i ISO8859-3 -- Central European - \i ISO8859-4 -- Baltic - \i ISO8859-5 -- Cyrillic - \i ISO8859-6 -- Arabic - \i ISO8859-7 -- Greek - \i ISO8859-8 -- Hebrew, visually ordered - \i ISO8859-8-i -- Hebrew, logically ordered - \i ISO8859-9 -- Turkish - \i ISO8859-10 - \i ISO8859-13 - \i ISO8859-14 - \i ISO8859-15 -- Western - \i IBM 850 - \i IBM 866 - \i CP874 - \i CP1250 -- Central European - \i CP1251 -- Cyrillic - \i CP1252 -- Western - \i CP1253 -- Greek - \i CP1254 -- Turkish - \i CP1255 -- Hebrew - \i CP1256 -- Arabic - \i CP1257 -- Baltic - \i CP1258 - \i Apple Roman - \i TIS-620 -- Thai - \endlist - - TQTextCodecs can be used as follows to convert some locally encoded - string to Unicode. Suppose you have some string encoded in Russian - KOI8-R encoding, and want to convert it to Unicode. The simple way - to do this is: - - \code - TQCString locallyEncoded = "..."; // text to convert - TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R - TQString unicodeString = codec->toUnicode( locallyEncoded ); - \endcode - - After this, \c{unicodeString} holds the text converted to Unicode. - Converting a string from Unicode to the local encoding is just as - easy: - - \code - TQString unicodeString = "..."; // any Unicode text - TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R - TQCString locallyEncoded = codec->fromUnicode( unicodeString ); - \endcode - - Some care must be taken when trying to convert the data in chunks, - for example, when receiving it over a network. In such cases it is - possible that a multi-byte character will be split over two - chunks. At best this might result in the loss of a character and - at worst cause the entire conversion to fail. - - The approach to use in these situations is to create a TQTextDecoder - object for the codec and use this TQTextDecoder for the whole - decoding process, as shown below: - - \code - TQTextCodec *codec = TQTextCodec::codecForName( "Shift-JIS" ); - TQTextDecoder *decoder = codec->makeDecoder(); - - TQString unicodeString; - while( receiving_data ) { - TQByteArray chunk = new_data; - unicodeString += decoder->toUnicode( chunk.data(), chunk.length() ); - } - \endcode - - The TQTextDecoder object maintains state between chunks and therefore - works correctly even if a multi-byte character is split between - chunks. - - \target subclassing - \section1 Creating your own Codec class - - Support for new text encodings can be added to TQt by creating - TQTextCodec subclasses. - - Built-in codecs can be overridden by custom codecs since more - recently created TQTextCodec objects take precedence over earlier - ones. - - You may find it more convenient to make your codec class available - as a plugin; see the \link plugins-howto.html plugin - documentation\endlink for more details. - - The abstract virtual functions describe the encoder to the - system and the coder is used as required in the different - text file formats supported by TQTextStream, and under X11, for the - locale-specific character input and output. - - To add support for another 8-bit encoding to TQt, make a subclass - of TQTextCodec and implement at least the following methods: - - \code - const char* name() const - \endcode - Return the official name for the encoding. - - \code - int mibEnum() const - \endcode - Return the MIB enum for the encoding if it is listed in the - \link http://www.iana.org/assignments/character-sets - IANA character-sets encoding file\endlink. - - If the encoding is multi-byte then it will have "state"; that is, - the interpretation of some bytes will be dependent on some preceding - bytes. For such encodings, you must implement: - - \code - TQTextDecoder* makeDecoder() const - \endcode - Return a TQTextDecoder that remembers incomplete multi-byte sequence - prefixes or other required state. - - If the encoding does \e not require state, you should implement: - - \code - TQString toUnicode(const char* chars, int len) const - \endcode - Converts \e len characters from \e chars to Unicode. - - The base TQTextCodec class has default implementations of the above - two functions, \e{but they are mutually recursive}, so you must - re-implement at least one of them, or both for improved efficiency. - - For conversion from Unicode to 8-bit encodings, it is rarely necessary - to maintain state. However, two functions similar to the two above - are used for encoding: - - \code - TQTextEncoder* makeEncoder() const - \endcode - Return a TQTextEncoder. - - \code - TQCString fromUnicode(const TQString& uc, int& lenInOut ) const - \endcode - Converts \e lenInOut characters (of type TQChar) from the start of - the string \e uc, returning a TQCString result, and also returning - the \link TQCString::length() length\endlink of the result in - \e lenInOut. - - Again, these are mutually recursive so only one needs to be implemented, - or both if greater efficiency is possible. - - Finally, you must implement: - - \code - int heuristicContentMatch(const char* chars, int len) const - \endcode - Gives a value indicating how likely it is that \e len characters - from \e chars are in the encoding. - - A good model for this function is the - TQWindowsLocalCodec::heuristicContentMatch function found in the TQt - sources. - - A TQTextCodec subclass might have improved performance if you also - re-implement: - - \code - bool canEncode( TQChar ) const - \endcode - Test if a Unicode character can be encoded. - - \code - bool canEncode( const TQString& ) const - \endcode - Test if a string of Unicode characters can be encoded. - - \code - int heuristicNameMatch(const char* hint) const - \endcode - Test if a possibly non-standard name is referring to the codec. - - Codecs can also be created as \link plugins-howto.html plugins\endlink. -*/ - - -/*! - \nonreentrant - - Constructs a TQTextCodec, and gives it the highest precedence. The - TQTextCodec should always be constructed on the heap (i.e. with \c - new). TQt takes ownership and will delete it when the application - terminates. -*/ -TQTextCodec::TQTextCodec() -{ - // 'codecs_destroyed' should never be true at this point - if (!codecs_destroyed) - { - setup(); -#ifdef TQT_THREAD_SUPPORT - TQMutexLocker locker( tqt_global_mutexpool ? - tqt_global_mutexpool->get( &all ) : 0 ); -#endif // TQT_THREAD_SUPPORT - all->insert( all->begin(), this ); - } -} - - -/*! - \nonreentrant - - Destroys the TQTextCodec. Note that you should not delete codecs - yourself: once created they become TQt's responsibility. -*/ -TQTextCodec::~TQTextCodec() -{ - if ( !codecs_destroyed ) - tqWarning("TQTextCodec::~TQTextCodec() called by application"); - -#ifdef TQT_THREAD_SUPPORT - TQMutexLocker locker( tqt_global_mutexpool ? - tqt_global_mutexpool->get( &all ) : 0 ); -#endif // TQT_THREAD_SUPPORT - if ( all ) - all->remove( this ); -} - - -/*! - Returns a value indicating how likely it is that this decoder is - appropriate for decoding some format that has the given name. The - name is compared with the \a hint. - - A good match returns a positive number around the length of the - string. A bad match is negative. - - The default implementation calls simpleHeuristicNameMatch() with - the name of the codec. -*/ -int TQTextCodec::heuristicNameMatch(const char* hint) const -{ - return simpleHeuristicNameMatch(name(),hint); -} - - -// returns a string containing the letters and numbers from input, -// with a space separating run of a character class. e.g. "iso8859-1" -// becomes "iso 8859 1" -static TQString lettersAndNumbers( const char * input ) -{ - TQString result; - TQChar c; - - while( input && *input ) { - c = *input; - if ( c.isLetter() || c.isNumber() ) - result += c.lower(); - if ( input[1] ) { - // add space at character class transition, except - // transition from upper-case to lower-case letter - TQChar n( input[1] ); - if ( c.isLetter() && n.isLetter() ) { - if ( c == c.lower() && n == n.upper() ) - result += ' '; - } else if ( c.category() != n.category() ) { - result += ' '; - } - } - input++; - } - return result.simplifyWhiteSpace(); -} - -/*! - A simple utility function for heuristicNameMatch(): it does some - very minor character-skipping so that almost-exact matches score - high. \a name is the text we're matching and \a hint is used for - the comparison. -*/ -int TQTextCodec::simpleHeuristicNameMatch(const char* name, const char* hint) -{ - // if they're the same, return a perfect score. - if ( name && hint && *name && *hint && tqstricmp( name, hint ) == 0 ) - return tqstrlen( hint ); - - // if the letters and numbers are the same, we have an "almost" - // perfect match. - TQString h( lettersAndNumbers( hint ) ); - TQString n( lettersAndNumbers( name ) ); - if ( h == n ) - return tqstrlen( hint )-1; - - if ( h.stripWhiteSpace() == n.stripWhiteSpace() ) - return tqstrlen( hint )-2; - - // could do some more here, but I don't think it's worth it - - return 0; -} - - -/*! - Returns the TQTextCodec \a i positions from the most recently - inserted codec, or 0 if there is no such TQTextCodec. Thus, - codecForIndex(0) returns the most recently created TQTextCodec. -*/ -TQTextCodec* TQTextCodec::codecForIndex(int i) -{ - if (codecs_destroyed) - { - return nullptr; - } - - setup(); - return (uint)i >= all->count() ? 0 : *all->at(i); -} - - -/*! - Returns the TQTextCodec which matches the \link - TQTextCodec::mibEnum() MIBenum\endlink \a mib. -*/ -TQTextCodec* TQTextCodec::codecForMib(int mib) -{ - if (codecs_destroyed) - { - return nullptr; - } - - setup(); - TQValueList<TQTextCodec*>::ConstIterator i; - TQTextCodec* result=0; - for ( i = all->begin(); i != all->end(); ++i ) { - result = *i; - if ( result->mibEnum()==mib ) - return result; - } - -#if !defined(TQT_NO_COMPONENT) && !defined(QT_LITE_COMPONENT) - if ( !result || (result && result->mibEnum() != mib) ) { - TQTextCodec *codec = TQTextCodecFactory::createForMib(mib); - if (codec) - result = codec; - } -#endif // !TQT_NO_COMPONENT !QT_LITE_COMPONENT - - return result; -} - - - - - -#ifdef Q_OS_WIN32 -class TQWindowsLocalCodec: public TQTextCodec -{ -public: - TQWindowsLocalCodec(); - ~TQWindowsLocalCodec(); - - TQString toUnicode(const char* chars, int len) const; - TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; - - const char* name() const; - int mibEnum() const; - - int heuristicContentMatch(const char* chars, int len) const; - - TQTextDecoder* makeDecoder() const; -}; - -TQWindowsLocalCodec::TQWindowsLocalCodec() -{ -} - -TQWindowsLocalCodec::~TQWindowsLocalCodec() -{ -} - - -TQString TQWindowsLocalCodec::toUnicode(const char* chars, int len) const -{ - if ( len == 1 && chars ) { // Optimization; avoids allocation - char c[2]; - c[0] = *chars; - c[1] = 0; - return qt_winMB2TQString( c, 2 ); - } - if ( len < 0 ) - return qt_winMB2TQString( chars ); - TQCString s(chars,len+1); - return qt_winMB2TQString(s); -} - -TQCString TQWindowsLocalCodec::fromUnicode(const TQString& uc, int& lenInOut ) const -{ - TQCString r = qt_winTQString2MB( uc, lenInOut ); - lenInOut = r.length(); - return r; -} - - -const char* TQWindowsLocalCodec::name() const -{ - return "System"; -} - -int TQWindowsLocalCodec::mibEnum() const -{ - return 0; -} - - -int TQWindowsLocalCodec::heuristicContentMatch(const char* chars, int len) const -{ - // ### Not a bad default implementation? - TQString t = toUnicode(chars,len); - int l = t.length(); - TQCString mb = fromUnicode(t,l); - int i=0; - while ( i < len ) { - if ( chars[i] == mb[i] ) - i++; - else - break; - } - return i; -} - -class TQWindowsLocalDecoder: public TQTextDecoder -{ - const TQWindowsLocalCodec* codec; - int nbuf; - uchar buf[4]; // hopefully this will be enough -public: - TQWindowsLocalDecoder(const TQWindowsLocalCodec *c) : codec(c), nbuf(0) - { - } - - TQString toUnicode(const char* chars, int len) - { - if (len != 1 && nbuf == 0) - return codec->toUnicode(chars, len); - if (len == 1) { - char c[sizeof buf + 2]; - memcpy(c, buf, nbuf); - c[nbuf] = *chars; - c[nbuf+1] = 0; - - // try to decode this: - TQString retval = codec->toUnicode(c, -1); - if ( retval.isEmpty() ) { - // it didn't return anything; we probably stopped mid-way in a multi-byte - // character - buf[nbuf++] = *chars; - if (nbuf + 1 == sizeof buf) { - tqWarning("TQWindowsLocalDecoder: exceeded max internal buffer size"); - nbuf = 0; - } - } - else - nbuf = 0; // decoded successfully - - return retval; - } - - if (len == -1) - len = (int)strlen(chars); - - // Ugh! We need to allocate memory - char *s = new char[nbuf + len + 1]; - memcpy(s, buf, nbuf); - memcpy(s + nbuf, chars, len); - s[nbuf + len] = 0; - - TQString retval = codec->toUnicode(s, -1); - nbuf = 0; - delete[] s; - return retval; - } -}; - -TQTextDecoder* TQWindowsLocalCodec::makeDecoder() const -{ - return new TQWindowsLocalDecoder(this); -} - -#else - -/* locale names mostly copied from XFree86 */ -static const char * const iso8859_2locales[] = { - "croatian", "cs", "cs_CS", "cs_CZ","cz", "cz_CZ", "czech", "hr", - "hr_HR", "hu", "hu_HU", "hungarian", "pl", "pl_PL", "polish", "ro", - "ro_RO", "rumanian", "serbocroatian", "sh", "sh_SP", "sh_YU", "sk", - "sk_SK", "sl", "sl_CS", "sl_SI", "slovak", "slovene", "sr_SP", 0 }; - -static const char * const iso8859_3locales[] = { - "eo", 0 }; - -static const char * const iso8859_4locales[] = { - "ee", "ee_EE", 0 }; - -static const char * const iso8859_5locales[] = { - "mk", "mk_MK", "sp", "sp_YU", 0 }; - -static const char * const cp_1251locales[] = { - "be", "be_BY", "bg", "bg_BG", "bulgarian", 0 }; - -static const char * const pt_154locales[] = { - "ba_RU", "ky", "ky_KG", "kk", "kk_KZ", 0 }; - -static const char * const iso8859_6locales[] = { - "ar_AA", "ar_SA", "arabic", 0 }; - -static const char * const iso8859_7locales[] = { - "el", "el_GR", "greek", 0 }; - -static const char * const iso8859_8locales[] = { - "hebrew", "he", "he_IL", "iw", "iw_IL", 0 }; - -static const char * const iso8859_9locales[] = { - "tr", "tr_TR", "turkish", 0 }; - -static const char * const iso8859_13locales[] = { - "lt", "lt_LT", "lv", "lv_LV", 0 }; - -static const char * const iso8859_15locales[] = { - "et", "et_EE", - // Euro countries - "br_FR", "ca_ES", "de", "de_AT", "de_BE", "de_DE", "de_LU", "en_IE", - "es", "es_ES", "eu_ES", "fi", "fi_FI", "finnish", "fr", "fr_FR", - "fr_BE", "fr_LU", "french", "ga_IE", "gl_ES", "it", "it_IT", "oc_FR", - "nl", "nl_BE", "nl_NL", "pt", "pt_PT", "sv_FI", "wa_BE", - 0 }; - -static const char * const koi8_ulocales[] = { - "uk", "uk_UA", "ru_UA", "ukrainian", 0 }; - -static const char * const tis_620locales[] = { - "th", "th_TH", "thai", 0 }; - -static const char * const tcvnlocales[] = { - "vi", "vi_VN", 0 }; - -static bool try_locale_list( const char * const locale[], const char * lang ) -{ - int i; - for( i=0; locale[i] && *locale[i] && strcmp(locale[i], lang); i++ ) - ; - return locale[i] != 0; -} - -// For the probably_koi8_locales we have to look. the standard says -// these are 8859-5, but almost all Russian users use KOI8-R and -// incorrectly set $LANG to ru_RU. We'll check tolower() to see what -// tolower() thinks ru_RU means. - -// If you read the history, it seems that many Russians blame ISO and -// Perestroika for the confusion. -// -// The real bug is that some programs break if the user specifies -// ru_RU.KOI8-R. - -static const char * const probably_koi8_rlocales[] = { - "ru", "ru_SU", "ru_RU", "russian", 0 }; - -static TQTextCodec * ru_RU_hack( const char * i ) { - TQTextCodec * ru_RU_codec = 0; - - TQCString origlocale = setlocale( LC_CTYPE, i ); - // unicode koi8r latin5 name - // 0x044E 0xC0 0xEE CYRILLIC SMALL LETTER YU - // 0x042E 0xE0 0xCE CYRILLIC CAPITAL LETTER YU - int latin5 = tolower( 0xCE ); - int koi8r = tolower( 0xE0 ); - if ( koi8r == 0xC0 && latin5 != 0xEE ) { - ru_RU_codec = TQTextCodec::codecForName( "KOI8-R" ); - } else if ( koi8r != 0xC0 && latin5 == 0xEE ) { - ru_RU_codec = TQTextCodec::codecForName( "ISO 8859-5" ); - } else { - // something else again... let's assume... *throws dice* - ru_RU_codec = TQTextCodec::codecForName( "KOI8-R" ); - tqWarning( "TQTextCodec: using KOI8-R, probe failed (%02x %02x %s)", - koi8r, latin5, i ); - } - setlocale( LC_CTYPE, origlocale.data() ); - - return ru_RU_codec; -} - -#endif - -/*! - Set the codec to \a c; this will be returned by codecForLocale(). - This might be needed for some applications that want to use their - own mechanism for setting the locale. - - \sa codecForLocale() -*/ -void TQTextCodec::setCodecForLocale(TQTextCodec *c) { - localeMapper = c; -} - -/*! Returns a pointer to the codec most suitable for this locale. */ - -TQTextCodec* TQTextCodec::codecForLocale() -{ - if (codecs_destroyed) - { - return nullptr; - } - - if (!localeMapper) - { - setup(); - } - - return localeMapper; -} - - -/*! - Searches all installed TQTextCodec objects and returns the one - which best matches \a name; the match is case-insensitive. Returns - 0 if no codec's heuristicNameMatch() reports a match better than - \a accuracy, or if \a name is a null string. - - \sa heuristicNameMatch() -*/ - -TQTextCodec* TQTextCodec::codecForName( const char* name, int accuracy ) -{ - if (codecs_destroyed) - { - return nullptr; - } - - if ( !name || !*name ) - return 0; - - setup(); - TQValueList<TQTextCodec*>::ConstIterator i; - TQTextCodec* result = 0; - int best = accuracy; - TQTextCodec* cursor; - for ( i = all->begin(); i != all->end(); ++i ) { - cursor = *i; - int s = cursor->heuristicNameMatch( name ); - if ( s > best ) { - best = s; - result = cursor; - } - } - -#if !defined(TQT_NO_COMPONENT) && !defined(QT_LITE_COMPONENT) - if ( !result ) - result = TQTextCodecFactory::createForName(name); -#endif // !TQT_NO_COMPONENT !QT_LITE_COMPONENT - - return result; -} - - -/*! - Searches all installed TQTextCodec objects, returning the one which - most recognizes the given content. May return 0. - - Note that this is often a poor choice, since character encodings - often use most of the available character sequences, and so only - by linguistic analysis could a true match be made. - - \a chars contains the string to check, and \a len contains the - number of characters in the string to use. - - \sa heuristicContentMatch() -*/ -TQTextCodec* TQTextCodec::codecForContent(const char* chars, int len) -{ - if (codecs_destroyed) - { - return nullptr; - } - - setup(); - TQValueList<TQTextCodec*>::ConstIterator i; - TQTextCodec* result = 0; - int best=0; - TQTextCodec* cursor; - for ( i = all->begin(); i != all->end(); ++i ) { - cursor = *i; - int s = cursor->heuristicContentMatch(chars,len); - if ( s > best ) { - best = s; - result = cursor; - } - } - return result; -} - - -/*! - \fn const char* TQTextCodec::name() const - - TQTextCodec subclasses must reimplement this function. It returns - the name of the encoding supported by the subclass. When choosing - a name for an encoding, consider these points: - \list - \i On X11, heuristicNameMatch( const char * hint ) - is used to test if a the TQTextCodec - can convert between Unicode and the encoding of a font - with encoding \e hint, such as "iso8859-1" for Latin-1 fonts, - "koi8-r" for Russian KOI8 fonts. - The default algorithm of heuristicNameMatch() uses name(). - \i Some applications may use this function to present - encodings to the end user. - \endlist - */ - -/*! - \fn int TQTextCodec::mibEnum() const - - Subclasses of TQTextCodec must reimplement this function. It - returns the MIBenum (see \link - http://www.iana.org/assignments/character-sets the - IANA character-sets encoding file\endlink for more information). - It is important that each TQTextCodec subclass returns the correct - unique value for this function. -*/ - - -/*! - Returns the preferred mime name of the encoding as defined in the - \link http://www.iana.org/assignments/character-sets - IANA character-sets encoding file\endlink. -*/ -const char* TQTextCodec::mimeName() const -{ - return name(); -} - - -/*! - \fn int TQTextCodec::heuristicContentMatch(const char* chars, int len) const - - TQTextCodec subclasses must reimplement this function. It examines - the first \a len bytes of \a chars and returns a value indicating - how likely it is that the string is a prefix of text encoded in - the encoding of the subclass. A negative return value indicates - that the text is detectably not in the encoding (e.g. it contains - characters undefined in the encoding). A return value of 0 - indicates that the text should be decoded with this codec rather - than as ASCII, but there is no particular evidence. The value - should range up to \a len. Thus, most decoders will return -1, 0, - or -\a len. - - The characters are not null terminated. - - \sa codecForContent(). -*/ - - -/*! - Creates a TQTextDecoder which stores enough state to decode chunks - of char* data to create chunks of Unicode data. The default - implementation creates a stateless decoder, which is only - sufficient for the simplest encodings where each byte corresponds - to exactly one Unicode character. - - The caller is responsible for deleting the returned object. -*/ -TQTextDecoder* TQTextCodec::makeDecoder() const -{ - return new TQTextStatelessDecoder(this); -} - - -/*! - Creates a TQTextEncoder which stores enough state to encode chunks - of Unicode data as char* data. The default implementation creates - a stateless encoder, which is only sufficient for the simplest - encodings where each Unicode character corresponds to exactly one - character. - - The caller is responsible for deleting the returned object. -*/ -TQTextEncoder* TQTextCodec::makeEncoder() const -{ - return new TQTextStatelessEncoder(this); -} - - -/*! - TQTextCodec subclasses must reimplement this function or - makeDecoder(). It converts the first \a len characters of \a chars - to Unicode. - - The default implementation makes a decoder with makeDecoder() and - converts the input with that. Note that the default makeDecoder() - implementation makes a decoder that simply calls - this function, hence subclasses \e must reimplement one function or - the other to avoid infinite recursion. -*/ -TQString TQTextCodec::toUnicode(const char* chars, int len) const -{ - if ( chars == 0 ) - return TQString::null; - TQTextDecoder* i = makeDecoder(); - TQString result = i->toUnicode(chars,len); - delete i; - return result; -} - - -/*! - TQTextCodec subclasses must reimplement either this function or - makeEncoder(). It converts the first \a lenInOut characters of \a - uc from Unicode to the encoding of the subclass. If \a lenInOut is - negative or too large, the length of \a uc is used instead. - - Converts \a lenInOut characters (not bytes) from \a uc, producing - a TQCString. \a lenInOut will be set to the \link - TQCString::length() length\endlink of the result (in bytes). - - The default implementation makes an encoder with makeEncoder() and - converts the input with that. Note that the default makeEncoder() - implementation makes an encoder that simply calls this function, - hence subclasses \e must reimplement one function or the other to - avoid infinite recursion. -*/ - -TQCString TQTextCodec::fromUnicode(const TQString& uc, int& lenInOut) const -{ - TQTextEncoder* i = makeEncoder(); - TQCString result = i->fromUnicode(uc, lenInOut); - delete i; - return result; -} - -/*! - \overload - \internal -*/ -TQByteArray TQTextCodec::fromUnicode( const TQString &str, int pos, int len ) const -{ - TQByteArray a; - if( len < 0 ) - len = str.length() - pos; - a = fromUnicode( str.mid(pos, len) ); - if( a.size() > 0 && a[(int)a.size() - 1] == '\0' ) - a.resize( a.size() - 1 ); - return a; -} - -/*! - \overload - - \a uc is the unicode source string. -*/ -TQCString TQTextCodec::fromUnicode(const TQString& uc) const -{ - int l = uc.length(); - return fromUnicode(uc,l); -} - -/*! - \overload - - \a a contains the source characters; \a len contains the number of - characters in \a a to use. -*/ -TQString TQTextCodec::toUnicode(const TQByteArray& a, int len) const -{ - int l = a.size(); - l = TQMIN( l, len ); - return toUnicode( a.data(), l ); -} - -/*! - \overload - - \a a contains the source characters. -*/ -TQString TQTextCodec::toUnicode(const TQByteArray& a) const -{ - int l = a.size(); - return toUnicode( a.data(), l ); -} - -/*! - \overload - - \a a contains the source characters; \a len contains the number of - characters in \a a to use. -*/ -TQString TQTextCodec::toUnicode(const TQCString& a, int len) const -{ - int l = a.length(); - l = TQMIN( l, len ); - return toUnicode( a.data(), l ); -} - -/*! - \overload - - \a a contains the source characters. -*/ -TQString TQTextCodec::toUnicode(const TQCString& a) const -{ - int l = a.length(); - return toUnicode( a.data(), l ); -} - -/*! - \overload - - \a chars contains the source characters. -*/ -TQString TQTextCodec::toUnicode(const char* chars) const -{ - return toUnicode(chars,tqstrlen(chars)); -} - -/*! - \internal -*/ -unsigned short TQTextCodec::characterFromUnicode(const TQString &str, int pos) const -{ - TQCString result = TQTextCodec::fromUnicode(TQString(str[pos])); - uchar *ch = (uchar *) result.data(); - ushort retval = 0; - if (result.size() > 2) { - retval = (ushort) *ch << 8; - ch++; - } - return retval + *ch; -} - -/*! - Returns TRUE if the Unicode character \a ch can be fully encoded - with this codec; otherwise returns FALSE. The default - implementation tests if the result of toUnicode(fromUnicode(ch)) - is the original \a ch. Subclasses may be able to improve the - efficiency. -*/ -bool TQTextCodec::canEncode( TQChar ch ) const -{ - return toUnicode(fromUnicode(ch)) == ch; -} - -/*! - \overload - - \a s contains the string being tested for encode-ability. -*/ -bool TQTextCodec::canEncode( const TQString& s ) const -{ - if ( s.isEmpty() ) - return TRUE; - return toUnicode(fromUnicode(s)) == s; -} - - - -/*! - \class TQTextEncoder ntqtextcodec.h - \brief The TQTextEncoder class provides a state-based encoder. - \reentrant - \ingroup i18n - - The encoder converts Unicode into another format, remembering any - state that is required between calls. - - \sa TQTextCodec::makeEncoder() -*/ - -/*! - Destroys the encoder. -*/ -TQTextEncoder::~TQTextEncoder() -{ -} - -/*! - \fn TQCString TQTextEncoder::fromUnicode(const TQString& uc, int& lenInOut) - - Converts \a lenInOut characters (not bytes) from \a uc, producing - a TQCString. \a lenInOut will be set to the \link - TQCString::length() length\endlink of the result (in bytes). - - The encoder is free to record state to use when subsequent calls - are made to this function (for example, it might change modes with - escape sequences if needed during the encoding of one string, then - assume that mode applies when a subsequent call begins). -*/ - -/*! - \class TQTextDecoder ntqtextcodec.h - \brief The TQTextDecoder class provides a state-based decoder. - \reentrant - \ingroup i18n - - The decoder converts a text format into Unicode, remembering any - state that is required between calls. - - \sa TQTextCodec::makeEncoder() -*/ - - -/*! - Destroys the decoder. -*/ -TQTextDecoder::~TQTextDecoder() -{ -} - -/*! - \fn TQString TQTextDecoder::toUnicode(const char* chars, int len) - - Converts the first \a len bytes in \a chars to Unicode, returning - the result. - - If not all characters are used (e.g. if only part of a multi-byte - encoding is at the end of the characters), the decoder remembers - enough state to continue with the next call to this function. -*/ - -#define CHAINED 0xffff - -struct TQMultiByteUnicodeTable { - // If multiByte, ignore unicode and index into multiByte - // with the next character. - TQMultiByteUnicodeTable() : unicode(0xfffd), multiByte(0) { } - - ~TQMultiByteUnicodeTable() - { - if ( multiByte ) - delete [] multiByte; - } - - ushort unicode; - TQMultiByteUnicodeTable* multiByte; -}; - -static int getByte(char* &cursor) -{ - int byte = 0; - if ( *cursor ) { - if ( cursor[1] == 'x' ) - byte = strtol(cursor+2,&cursor,16); - else if ( cursor[1] == 'd' ) - byte = strtol(cursor+2,&cursor,10); - else - byte = strtol(cursor+2,&cursor,8); - } - return byte&0xff; -} - -class TQTextCodecFromIOD; - -class TQTextCodecFromIODDecoder : public TQTextDecoder { - const TQTextCodecFromIOD* codec; - TQMultiByteUnicodeTable* mb; -public: - TQTextCodecFromIODDecoder(const TQTextCodecFromIOD* c); - TQString toUnicode(const char* chars, int len); -}; - -class TQTextCodecFromIOD : public TQTextCodec { - friend class TQTextCodecFromIODDecoder; - - TQCString n; - - // If from_unicode_page[row()][cell()] is 0 and from_unicode_page_multiByte, - // use from_unicode_page_multiByte[row()][cell()] as string. - char** from_unicode_page; - char*** from_unicode_page_multiByte; - char unkn; - - // Only one of these is used - ushort* to_unicode; - TQMultiByteUnicodeTable* to_unicode_multiByte; - int max_bytes_per_char; - TQStrList aliases; - - bool stateless() const { return !to_unicode_multiByte; } - -public: - TQTextCodecFromIOD(TQIODevice* iod) - { - from_unicode_page = 0; - to_unicode_multiByte = 0; - to_unicode = 0; - from_unicode_page_multiByte = 0; - max_bytes_per_char = 1; - - const int maxlen=100; - char line[maxlen]; - char esc='\\'; - char comm='%'; - bool incmap = FALSE; - while (iod->readLine(line,maxlen) > 0) { - if (0==tqstrnicmp(line,"<code_set_name>",15)) - n = line+15; - else if (0==tqstrnicmp(line,"<escape_char> ",14)) - esc = line[14]; - else if (0==tqstrnicmp(line,"<comment_char> ",15)) - comm = line[15]; - else if (line[0]==comm && 0==tqstrnicmp(line+1," alias ",7)) { - aliases.append(line+8); - } else if (0==tqstrnicmp(line,"CHARMAP",7)) { - if (!from_unicode_page) { - from_unicode_page = new char*[256]; - for (int i=0; i<256; i++) - from_unicode_page[i]=0; - } - if (!to_unicode) { - to_unicode = new ushort[256]; - } - incmap = TRUE; - } else if (0==tqstrnicmp(line,"END CHARMAP",11)) - break; - else if (incmap) { - char* cursor = line; - int byte=-1,unicode=-1; - ushort* mb_unicode=0; - const int maxmb=8; // more -> we'll need to improve datastructures - char mb[maxmb+1]; - int nmb=0; - - while (*cursor) { - if (cursor[0]=='<' && cursor[1]=='U' && - cursor[2]>='0' && cursor[2]<='9' && - cursor[3]>='0' && cursor[3]<='9') { - - unicode = strtol(cursor+2,&cursor,16); - - } else if (*cursor==esc) { - - byte = getByte(cursor); - - if ( *cursor == esc ) { - if ( !to_unicode_multiByte ) { - to_unicode_multiByte = - new TQMultiByteUnicodeTable[256]; - for (int i=0; i<256; i++) { - to_unicode_multiByte[i].unicode = - to_unicode[i]; - to_unicode_multiByte[i].multiByte = 0; - } - delete [] to_unicode; - to_unicode = 0; - } - TQMultiByteUnicodeTable* mbut = - to_unicode_multiByte+byte; - mb[nmb++] = byte; - while ( nmb < maxmb && *cursor == esc ) { - // Always at least once - - mbut->unicode = CHAINED; - byte = getByte(cursor); - mb[nmb++] = byte; - if (!mbut->multiByte) { - mbut->multiByte = - new TQMultiByteUnicodeTable[256]; - } - mbut = mbut->multiByte+byte; - mb_unicode = & mbut->unicode; - } - - if ( nmb > max_bytes_per_char ) - max_bytes_per_char = nmb; - } - } else { - cursor++; - } - } - - if (unicode >= 0 && unicode <= 0xffff) - { - TQChar ch((ushort)unicode); - if (!from_unicode_page[ch.row()]) { - from_unicode_page[ch.row()] = new char[256]; - for (int i=0; i<256; i++) - from_unicode_page[ch.row()][i]=0; - } - if ( mb_unicode ) { - from_unicode_page[ch.row()][ch.cell()] = 0; - if (!from_unicode_page_multiByte) { - from_unicode_page_multiByte = new char**[256]; - for (int i=0; i<256; i++) - from_unicode_page_multiByte[i]=0; - } - if (!from_unicode_page_multiByte[ch.row()]) { - from_unicode_page_multiByte[ch.row()] = new char*[256]; - for (int i=0; i<256; i++) - from_unicode_page_multiByte[ch.row()][i] = 0; - } - mb[nmb++] = 0; - from_unicode_page_multiByte[ch.row()][ch.cell()] - = tqstrdup(mb); - *mb_unicode = unicode; - } else { - from_unicode_page[ch.row()][ch.cell()] = (char)byte; - if ( to_unicode ) - to_unicode[byte] = unicode; - else - to_unicode_multiByte[byte].unicode = unicode; - } - } else { - } - } - } - n = n.stripWhiteSpace(); - - unkn = '?'; // ##### Might be a bad choice. - } - - ~TQTextCodecFromIOD() - { - if ( from_unicode_page ) { - for (int i=0; i<256; i++) - if (from_unicode_page[i]) - delete [] from_unicode_page[i]; - } - if ( from_unicode_page_multiByte ) { - for (int i=0; i<256; i++) - if (from_unicode_page_multiByte[i]) - for (int j=0; j<256; j++) - if (from_unicode_page_multiByte[i][j]) - delete [] from_unicode_page_multiByte[i][j]; - } - if ( to_unicode ) - delete [] to_unicode; - if ( to_unicode_multiByte ) - delete [] to_unicode_multiByte; - } - - bool ok() const - { - return !!from_unicode_page; - } - - TQTextDecoder* makeDecoder() const - { - if ( stateless() ) - return TQTextCodec::makeDecoder(); - else - return new TQTextCodecFromIODDecoder(this); - } - - const char* name() const - { - return n; - } - - int mibEnum() const - { - return 0; // #### Unknown. - } - - int heuristicContentMatch(const char*, int) const - { - return 0; - } - - int heuristicNameMatch(const char* hint) const - { - int bestr = TQTextCodec::heuristicNameMatch(hint); - TQStrListIterator it(aliases); - char* a; - while ((a=it.current())) { - ++it; - int r = simpleHeuristicNameMatch(a,hint); - if (r > bestr) - bestr = r; - } - return bestr; - } - - TQString toUnicode(const char* chars, int len) const - { - const uchar* uchars = (const uchar*)chars; - TQString result; - TQMultiByteUnicodeTable* multiByte=to_unicode_multiByte; - if ( multiByte ) { - while (len--) { - TQMultiByteUnicodeTable& mb = multiByte[*uchars]; - if ( mb.multiByte ) { - // Chained multi-byte - multiByte = mb.multiByte; - } else { - result += TQChar(mb.unicode); - multiByte=to_unicode_multiByte; - } - uchars++; - } - } else { - while (len--) - result += TQChar(to_unicode[*uchars++]); - } - return result; - } - -#if !defined(Q_NO_USING_KEYWORD) - using TQTextCodec::fromUnicode; -#endif - TQCString fromUnicode(const TQString& uc, int& lenInOut) const - { - if (lenInOut > (int)uc.length()) - lenInOut = uc.length(); - int rlen = lenInOut*max_bytes_per_char; - TQCString rstr(rlen+1); - char* cursor = rstr.data(); - char* s=0; - int l = lenInOut; - int lout = 0; - for (int i=0; i<l; i++) { - TQChar ch = uc[i]; - if ( ch == TQChar::null ) { - // special - *cursor++ = 0; - } else if ( from_unicode_page[ch.row()] && - from_unicode_page[ch.row()][ch.cell()] ) - { - *cursor++ = from_unicode_page[ch.row()][ch.cell()]; - lout++; - } else if ( from_unicode_page_multiByte && - from_unicode_page_multiByte[ch.row()] && - (s=from_unicode_page_multiByte[ch.row()][ch.cell()]) ) - { - while (*s) { - *cursor++ = *s++; - lout++; - } - } else { - *cursor++ = unkn; - lout++; - } - } - *cursor = 0; - lenInOut = lout; - return rstr; - } -}; - -TQTextCodecFromIODDecoder::TQTextCodecFromIODDecoder(const TQTextCodecFromIOD* c) : - codec(c) -{ - mb = codec->to_unicode_multiByte; -} - -TQString TQTextCodecFromIODDecoder::toUnicode(const char* chars, int len) -{ - const uchar* uchars = (const uchar*)chars; - TQString result; - while (len--) { - TQMultiByteUnicodeTable& t = mb[*uchars]; - if ( t.multiByte ) { - // Chained multi-byte - mb = t.multiByte; - } else { - if ( t.unicode ) - result += TQChar(t.unicode); - mb=codec->to_unicode_multiByte; - } - uchars++; - } - return result; -} - -#ifndef TQT_NO_CODECS -// Cannot use <pre> or \code -/*! - Reads a POSIX2 charmap definition from \a iod. - The parser recognizes the following lines: - -<font name="sans"> -  <code_set_name> <i>name</i></br> -  <escape_char> <i>character</i></br> -  % alias <i>alias</i></br> -  CHARMAP</br> -  <<i>token</i>> /x<i>hexbyte</i> <U<i>unicode</i>> ...</br> -  <<i>token</i>> /d<i>decbyte</i> <U<i>unicode</i>> ...</br> -  <<i>token</i>> /<i>octbyte</i> <U<i>unicode</i>> ...</br> -  <<i>token</i>> /<i>any</i>/<i>any</i>... <U<i>unicode</i>> ...</br> -  END CHARMAP</br> -</font> - - The resulting TQTextCodec is returned (and also added to the global - list of codecs). The name() of the result is taken from the - code_set_name. - - Note that a codec constructed in this way uses much more memory - and is slower than a hand-written TQTextCodec subclass, since - tables in code are kept in memory shared by all TQt applications. - - \sa loadCharmapFile() -*/ -TQTextCodec* TQTextCodec::loadCharmap(TQIODevice* iod) -{ - TQTextCodecFromIOD* r = new TQTextCodecFromIOD(iod); - if ( !r->ok() ) { - delete r; - r = 0; - } - return r; -} - -/*! - A convenience function for loadCharmap() that loads the charmap - definition from the file \a filename. -*/ -TQTextCodec* TQTextCodec::loadCharmapFile(TQString filename) -{ - TQFile f(filename); - if (f.open(IO_ReadOnly)) { - TQTextCodecFromIOD* r = new TQTextCodecFromIOD(&f); - if ( !r->ok() ) - delete r; - else - return r; - } - return 0; -} - -#endif //TQT_NO_CODECS - -/*! - Returns a string representing the current language and - sublanguage, e.g. "pt" for Portuguese, or "pt_br" for Portuguese/Brazil. -*/ - -const char* TQTextCodec::locale() -{ - return TQLocalePrivate::systemLocaleName(); -} - -#ifndef TQT_NO_CODECS - -class TQSimpleTextCodec: public TQTextCodec -{ -public: - TQSimpleTextCodec( int ); - ~TQSimpleTextCodec(); - - TQString toUnicode(const char* chars, int len) const; -#if !defined(Q_NO_USING_KEYWORD) - using TQTextCodec::fromUnicode; -#endif - TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; - unsigned short characterFromUnicode(const TQString &str, int pos) const; - - const char* name() const; - const char* mimeName() const; - int mibEnum() const; - - int heuristicContentMatch(const char* chars, int len) const; - - int heuristicNameMatch(const char* hint) const; -#if !defined(Q_NO_USING_KEYWORD) - using TQTextCodec::canEncode; -#endif - bool canEncode( TQChar ch ) const; - - void fromUnicode( const TQChar *in, unsigned short *out, int length ) const; - -private: - void buildReverseMap(); - - int forwardIndex; -#ifndef TQ_WS_QWS - TQMemArray<unsigned char> *reverseMap; -#endif -}; - -#ifdef TQ_WS_QWS -static const TQSimpleTextCodec * reverseOwner = 0; -static TQMemArray<unsigned char> * reverseMap = 0; -#endif - -#define LAST_MIB 2004 - -static const struct { - const char *mime; - const char * cs; - int mib; - TQ_UINT16 values[128]; -} unicodevalues[] = { - // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt - { "KOI8-R", "KOI8-R", 2084, - { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, - 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, - 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248, - 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, - 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, - 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, - 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, - 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, - 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, - 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, - 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } }, - // /**/ - The BULLET OPERATOR is confused. Some people think - // it should be 0x2022 (BULLET). - - // from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt - { "KOI8-U", "KOI8-U", 2088, - { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, - 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, - 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, - 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, - 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, - 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E, - 0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9, - 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, - 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, - 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, - 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } }, - - // next bits generated from tables on the Unicode 2.0 CD. we can - // use these tables since this is part of the transition to using - // unicode everywhere in qt. - - // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits ) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done - - // then I inserted the files manually. - { "ISO-8859-2", "ISO 8859-2", 5, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, - 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, - 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, - 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, - 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, - 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, - { "ISO-8859-3", "ISO 8859-3", 6, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFD, 0x0124, 0x00A7, - 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFD, 0x017B, - 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, - 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFD, 0x017C, - 0x00C0, 0x00C1, 0x00C2, 0xFFFD, 0x00C4, 0x010A, 0x0108, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0xFFFD, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, - 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0xFFFD, 0x00E4, 0x010B, 0x0109, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, - 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} }, - { "ISO-8859-4", "ISO 8859-4", 7, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, - 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, - 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, - 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, - 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, - 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} }, - { "ISO-8859-5", "ISO 8859-5", 8, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} }, - { "ISO-8859-6", "ISO 8859-6", 82, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x060C, 0x00AD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0x061B, 0xFFFD, 0xFFFD, 0xFFFD, 0x061F, - 0xFFFD, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, - 0x0638, 0x0639, 0x063A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, - 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, - 0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, - { "ISO-8859-7", "ISO 8859-7", 10, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x2018, 0x2019, 0x00A3, 0xFFFD, 0xFFFD, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0xFFFD, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, - 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, - { "ISO-8859-8-I", "ISO 8859-8-I", 85, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2017, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, - { "ISO-8859-9", "ISO 8859-9", 12, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, - { "ISO-8859-10", "ISO 8859-10", 13, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, - 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, - 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, - 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, - 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, - 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} }, - { "ISO-8859-13", "ISO 8859-13", 109, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, - 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, - 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, - 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, - 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, - 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, - 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} }, - { "ISO-8859-14", "ISO 8859-14", 110, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, - 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, - 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, - 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} }, - { "ISO-8859-16", "ISO 8859-16", 112, - { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x0104, 0x0105, 0x0141, 0x20AC, 0x201E, 0x0160, 0x00A7, - 0x0161, 0x00A9, 0x0218, 0x00AB, 0x0179, 0x00AD, 0x017A, 0x017B, - 0x00B0, 0x00B1, 0x010C, 0x0142, 0x017D, 0x201D, 0x00B6, 0x00B7, - 0x017E, 0x010D, 0x0219, 0x00BB, 0x0152, 0x0153, 0x0178, 0x017C, - 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0106, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0110, 0x0143, 0x00D2, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x015A, - 0x0170, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0118, 0x021A, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x0107, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, - 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF} }, - - // next bits generated again from tables on the Unicode 3.0 CD. - - // $ for a in CP* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done - - { "CP 850", "IBM 850", 2009, - { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, - 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, - 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, - 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, - 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, - 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, - 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, - 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, - 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, - 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, - 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, - 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, - 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0} }, - { "CP 874", "CP 874", 0, //### what is the mib? - { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, - 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, - 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, - 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, - 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, - 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, - 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, - 0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F, - 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, - 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, - 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, - { "IBM 866", "IBM 866", 2086, - { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, - 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, - 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, - 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, - 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} }, - - { "windows-1250", "CP 1250", 2250, - { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, - 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, - 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, - 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, - 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, - 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, - { "windows-1251", "CP 1251", 2251, - { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, - 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, - 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, - 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, - 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, - 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, - 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} }, - { "windows-1252", "CP 1252", 2252, - { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0x017E, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, - { "windows-1253", "CP 1253", 2253, - { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, - 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, - { "windows-1254", "CP 1254", 2254, - { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, - { "windows-1255", "CP 1255", 2255, - { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, - 0x05B8, 0x05B9, 0xFFFD, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, - 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, - 0x05F4, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, - 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, - 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, - 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} }, - { "windows-1256", "CP 1256", 2256, - { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, - 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, - 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, - 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, - 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, - 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, - 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, - 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} }, - { "windows-1257", "CP 1257", 2257, - { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, - 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0x00AF, 0x02DB, 0xFFFD, - 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0xFFFD, 0x00A6, 0x00A7, - 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, - 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, - 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, - 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, - 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, - 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, - 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, - 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, - 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} }, - { "windows-1258", "CP 1258", 2258, - { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, - 0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0xFFFD, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, - 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, - 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, - 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, - - { "Apple Roman", "Apple Roman", 0, - { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, - 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, - 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, - 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, - 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, - 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, - 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, - 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, - 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, - 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, - 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, - 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, - 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, - 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, - 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, - 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7} }, - - - - // This one is based on the charmap file - // /usr/share/i18n/charmaps/SAMI-WS2.gz, which is manually adapted - // to this format by Børre Gaup <boerre@subdimension.com> - { "WINSAMI2", "WS2", 0, - { 0x20AC, 0xFFFD, 0x010C, 0x0192, 0x010D, 0x01B7, 0x0292, 0x01EE, - 0x01EF, 0x0110, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x0111, 0x01E6, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, - 0x00A0, 0x01E7, 0x01E4, 0x00A3, 0x00A4, 0x01E5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x021E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x021F, - 0x00B0, 0x00B1, 0x01E8, 0x01E9, 0x00B4, 0x00B5, 0x00B6, 0x00B7, - 0x014A, 0x014B, 0x0166, 0x00BB, 0x0167, 0x00BD, 0x017D, 0x017E, - 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, - - - // this one is generated from the charmap file located in /usr/share/i18n/charmaps - // on most Linux distributions. The thai character set tis620 is byte by byte equivalent - // to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too. - - // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; ( cut -c25- < TIS-620 ; cat /tmp/digits ) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's/<U/0x/' -e 's/>//' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620 - { "TIS-620", "ISO 8859-11", 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent) - { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, - 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, - 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, - 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, - 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, - 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, - 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, - 0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F, - 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, - 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, - 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD } }, - - /* - Name: hp-roman8 [HP-PCL5,RFC1345,KXS2] - MIBenum: 2004 - Source: LaserJet IIP Printer User's Manual, - HP part no 33471-90901, Hewlet-Packard, June 1989. - Alias: roman8 - Alias: r8 - Alias: csHPRoman8 - */ - { "Roman8", "HP-Roman8", 2004, - { 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, - 0x00A0, 0x00C0, 0x00C2, 0x00C8, 0x00CA, 0x00CB, 0x00CE, 0x00CF, - 0x00B4, 0x02CB, 0x02C6, 0x00A8, 0x02DC, 0x00D9, 0x00DB, 0x20A4, - 0x00AF, 0x00DD, 0x00FD, 0x00B0, 0x00C7, 0x00E7, 0x00D1, 0x00F1, - 0x00A1, 0x00BF, 0x00A4, 0x00A3, 0x00A5, 0x00A7, 0x0192, 0x00A2, - 0x00E2, 0x00EA, 0x00F4, 0x00FB, 0x00E1, 0x00E9, 0x00F3, 0x00FA, - 0x00E0, 0x00E8, 0x00F2, 0x00F9, 0x00E4, 0x00EB, 0x00F6, 0x00FC, - 0x00C5, 0x00EE, 0x00D8, 0x00C6, 0x00E5, 0x00ED, 0x00F8, 0x00E6, - 0x00C4, 0x00EC, 0x00D6, 0x00DC, 0x00C9, 0x00EF, 0x00DF, 0x00D4, - 0x00C1, 0x00C3, 0x00E3, 0x00D0, 0x00F0, 0x00CD, 0x00CC, 0x00D3, - 0x00D2, 0x00D5, 0x00F5, 0x0160, 0x0161, 0x00DA, 0x0178, 0x00FF, - 0x00DE, 0x00FE, 0x00B7, 0x00B5, 0x00B6, 0x00BE, 0x2014, 0x00BC, - 0x00BD, 0x00AA, 0x00BA, 0x00AB, 0x25A0, 0x00BB, 0x00B1, 0xFFFD } } - - // if you add more chacater sets at the end, change LAST_MIB above -}; - -TQSimpleTextCodec::TQSimpleTextCodec( int i ) - : TQTextCodec(), forwardIndex( i ) -{ -#ifndef TQ_WS_QWS - reverseMap = 0; -#endif -} - - -TQSimpleTextCodec::~TQSimpleTextCodec() -{ -#ifndef TQ_WS_QWS - delete reverseMap; -#else - if ( reverseOwner == this ) { - delete reverseMap; - reverseMap = 0; - reverseOwner = 0; - } -#endif -} - -void TQSimpleTextCodec::buildReverseMap() -{ -#ifdef TQ_WS_QWS - if ( reverseOwner != this ) { - int m = 0; - int i = 0; - while( i < 128 ) { - if ( unicodevalues[forwardIndex].values[i] > m && - unicodevalues[forwardIndex].values[i] < 0xfffd ) - m = unicodevalues[forwardIndex].values[i]; - i++; - } - m++; - if ( !reverseMap ) - reverseMap = new TQMemArray<unsigned char>( m ); - if ( m > (int)(reverseMap->size()) ) - reverseMap->resize( m ); - for( i = 0; i < 128 && i < m; i++ ) - (*reverseMap)[i] = (char)i; - for( ;i < m; i++ ) - (*reverseMap)[i] = 0; - for( i=128; i<256; i++ ) { - int u = unicodevalues[forwardIndex].values[i-128]; - if ( u < m ) - (*reverseMap)[u] = (char)(unsigned char)(i); - } - reverseOwner = this; - } -#else - if ( !reverseMap ) { - TQMemArray<unsigned char> **map = &((TQSimpleTextCodec *)this)->reverseMap; - int m = 0; - int i = 0; - while( i < 128 ) { - if ( unicodevalues[forwardIndex].values[i] > m && - unicodevalues[forwardIndex].values[i] < 0xfffd ) - m = unicodevalues[forwardIndex].values[i]; - i++; - } - m++; - *map = new TQMemArray<unsigned char>( m ); - for( i = 0; i < 128 && i < m; i++ ) - (**map)[i] = (char)i; - for( ;i < m; i++ ) - (**map)[i] = 0; - for( i=128; i<256; i++ ) { - int u = unicodevalues[forwardIndex].values[i-128]; - if ( u < m ) - (**map)[u] = (char)(unsigned char)(i); - } - } -#endif -} - -TQString TQSimpleTextCodec::toUnicode(const char* chars, int len) const -{ - if ( len <= 0 || chars == 0 ) - return TQString::null; - - const unsigned char * c = (const unsigned char *)chars; - int i; - - for ( i = 0; i < len; i++ ) - if ( c[i] == '\0' ) { - len = i; - break; - } - - TQString r; - r.setUnicode(0, len); - TQChar* uc = (TQChar*)r.unicode(); // const_cast - - for ( i = 0; i < len; i++ ) { - if ( c[i] > 127 ) - uc[i] = unicodevalues[forwardIndex].values[c[i]-128]; - else - uc[i] = c[i]; - } - return r; -} - - -TQCString TQSimpleTextCodec::fromUnicode(const TQString& uc, int& len ) const -{ -#ifdef TQ_WS_QWS - if ( this != reverseOwner ) -#else - if ( !reverseMap ) -#endif - ((TQSimpleTextCodec *)this)->buildReverseMap(); - - if ( len <0 || len > (int)uc.length() ) - len = uc.length(); - TQCString r( len+1 ); - int i = len; - int u; - const TQChar* ucp = uc.unicode(); - unsigned char* rp = (unsigned char *)r.data(); - unsigned char* rmp = reverseMap->data(); - int rmsize = (int) reverseMap->size(); - while( i-- ) - { - u = ucp->unicode(); - *rp = u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : '?' ); - if ( *rp == 0 ) *rp = '?'; - rp++; - ucp++; - } - r[len] = 0; - return r; -} - -void TQSimpleTextCodec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const -{ -#ifdef TQ_WS_QWS - if ( this != reverseOwner ) -#else - if ( !reverseMap ) -#endif - ((TQSimpleTextCodec *)this)->buildReverseMap(); - - unsigned char* rmp = reverseMap->data(); - int rmsize = (int) reverseMap->size(); - while ( length-- ) { - unsigned short u = in->unicode(); - *out = u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : 0 ); - ++in; - ++out; - } -} - -unsigned short TQSimpleTextCodec::characterFromUnicode(const TQString &str, int pos) const -{ -#ifdef TQ_WS_QWS - if ( this != reverseOwner ) -#else - if ( !reverseMap ) -#endif - ((TQSimpleTextCodec *)this)->buildReverseMap(); - - unsigned short u = str[pos].unicode(); - unsigned char* rmp = reverseMap->data(); - int rmsize = (int) reverseMap->size(); - return u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : 0 ); -} - -bool TQSimpleTextCodec::canEncode( TQChar ch ) const -{ -#ifdef TQ_WS_QWS - if ( this != reverseOwner ) -#else - if ( !reverseMap ) -#endif - ((TQSimpleTextCodec *)this)->buildReverseMap(); - - unsigned short u = ch.unicode(); - unsigned char* rmp = reverseMap->data(); - int rmsize = (int) reverseMap->size(); - return u < 128 ? TRUE : (( u < rmsize ) ? (*(rmp+u) != 0) : FALSE ); -} - -const char* TQSimpleTextCodec::name() const -{ - return unicodevalues[forwardIndex].cs; -} - -const char* TQSimpleTextCodec::mimeName() const -{ - return unicodevalues[forwardIndex].mime; -} - - -int TQSimpleTextCodec::mibEnum() const -{ - return unicodevalues[forwardIndex].mib; -} - -int TQSimpleTextCodec::heuristicNameMatch(const char* hint) const -{ - if ( tqstricmp( hint, mimeName() ) == 0 ) - return 10000; // return a large value - if ( hint[0]=='k' ) { - TQCString lhint = TQCString(hint).lower(); - // Help people with messy fonts - if ( lhint == "koi8-1" ) - return TQTextCodec::heuristicNameMatch("koi8-r")-1; - if ( lhint == "koi8-ru" ) - return TQTextCodec::heuristicNameMatch("koi8-r")-1; - } else if ( hint[0] == 't' && mibEnum() == 2259 /* iso8859-11 */ ) { - // 8859-11 and tis620 are byte by byte equivalent - int i = simpleHeuristicNameMatch("tis620-0", hint); - if( !i ) - i = simpleHeuristicNameMatch("tis-620", hint); - if( i ) return i; - } else if ( mibEnum() == 82 /* ISO 8859-6 */ ) { - int i = simpleHeuristicNameMatch("ISO 8859-6-I", hint); - if ( i ) - return i; - } - return TQTextCodec::heuristicNameMatch(hint); -} - -int TQSimpleTextCodec::heuristicContentMatch(const char* chars, int len) const -{ - if ( len<1 || !chars ) - return -1; - int i = 0; - const uchar * c = (const unsigned char *)chars; - int r = 0; - while( i<len && c && *c ) { - if ( *c >= 128 ) { - if ( unicodevalues[forwardIndex].values[(*c)-128] == 0xfffd ) - return -1; - } - if ( (*c >= ' ' && *c < 127) || - *c == '\n' || *c == '\t' || *c == '\r' ) - r++; - i++; - c++; - } - if ( mibEnum()==4 ) - r+=1; - return r; -} - -#endif - -class TQLatin1Codec : public TQTextCodec -{ -public: -#if !defined(Q_NO_USING_KEYWORD) - using TQTextCodec::fromUnicode; - using TQTextCodec::toUnicode; -#endif - TQString toUnicode(const char* chars, int len) const; - TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; - void fromUnicode( const TQChar *in, unsigned short *out, int length ) const; - unsigned short characterFromUnicode(const TQString &str, int pos) const; - - const char* name() const; - const char* mimeName() const; - int mibEnum() const; - - int heuristicContentMatch(const char* chars, int len) const; - -private: - int forwardIndex; -}; - - -TQString TQLatin1Codec::toUnicode(const char* chars, int len) const -{ - if ( chars == 0 ) - return TQString::null; - - return TQString::fromLatin1(chars, len); -} - - -TQCString TQLatin1Codec::fromUnicode(const TQString& uc, int& len ) const -{ - if ( len <0 || len > (int)uc.length() ) - len = uc.length(); - TQCString r( len+1 ); - char *d = r.data(); - int i = 0; - const TQChar *ch = uc.unicode(); - while ( i < len ) { - d[i] = ch->row() ? '?' : ch->cell(); - i++; - ch++; - } - r[len] = 0; - return r; -} - -void TQLatin1Codec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const -{ - while ( length-- ) { - *out = in->row() ? 0 : in->cell(); - ++in; - ++out; - } -} - -unsigned short TQLatin1Codec::characterFromUnicode(const TQString &str, int pos) const -{ - const TQChar *ch = str.unicode() + pos; - if (ch->row()) - return 0; - return (unsigned short) ch->cell(); -} - - -const char* TQLatin1Codec::name() const -{ - return "ISO 8859-1"; -} - -const char* TQLatin1Codec::mimeName() const -{ - return "ISO-8859-1"; -} - - -int TQLatin1Codec::mibEnum() const -{ - return 4; -} - -int TQLatin1Codec::heuristicContentMatch(const char* chars, int len) const -{ - if ( len<1 || !chars ) - return -1; - int i = 0; - const uchar * c = (const unsigned char *)chars; - int r = 0; - while( i<len && c && *c ) { - if ( *c >= 0x80 && *c < 0xa0 ) - return -1; - if ( (*c >= ' ' && *c < 127) || - *c == '\n' || *c == '\t' || *c == '\r' ) - r++; - i++; - c++; - } - if ( this == (const TQTextCodec *)codecForLocale() ) - r += 5; - return r; -} - -class TQLatin15Codec: public TQLatin1Codec -{ -public: - TQString toUnicode(const char* chars, int len) const; -#if !defined(Q_NO_USING_KEYWORD) - using TQLatin1Codec::fromUnicode; -#endif - TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; - void fromUnicode( const TQChar *in, unsigned short *out, int length ) const; - unsigned short characterFromUnicode(const TQString &str, int pos) const; - - const char* name() const; - const char* mimeName() const; - int mibEnum() const; - -private: - int forwardIndex; -}; - - -TQString TQLatin15Codec::toUnicode(const char* chars, int len) const -{ - if ( chars == 0 ) - return TQString::null; - - TQString str = TQString::fromLatin1(chars, len); - TQChar *uc = (TQChar *)str.unicode(); - while( len-- ) { - switch( uc->unicode() ) { - case 0xa4: - *uc = 0x20ac; - break; - case 0xa6: - *uc = 0x0160; - break; - case 0xa8: - *uc = 0x0161; - break; - case 0xb4: - *uc = 0x017d; - break; - case 0xb8: - *uc = 0x017e; - break; - case 0xbc: - *uc = 0x0152; - break; - case 0xbd: - *uc = 0x0153; - break; - case 0xbe: - *uc = 0x0178; - break; - default: - break; - } - uc++; - } - return str; -} - -static inline unsigned char -latin15CharFromUnicode( unsigned short uc, bool replacement = TRUE ) -{ - uchar c; - if ( uc < 0x0100 ) { - if ( uc > 0xa3 && uc < 0xbf ) { - switch( uc ) { - case 0xa4: - case 0xa6: - case 0xa8: - case 0xb4: - case 0xb8: - case 0xbc: - case 0xbd: - case 0xbe: - c = replacement ? '?' : 0; - break; - default: - c = (unsigned char) uc; - break; - } - } else { - c = (unsigned char) uc; - } - } else { - if ( uc == 0x20ac ) - c = 0xa4; - else if ( (uc & 0xff00) == 0x0100 ) { - switch( uc ) { - case 0x0160: - c = 0xa6; - break; - case 0x0161: - c = 0xa8; - break; - case 0x017d: - c = 0xb4; - break; - case 0x017e: - c = 0xb8; - break; - case 0x0152: - c = 0xbc; - break; - case 0x0153: - c = 0xbd; - break; - case 0x0178: - c = 0xbe; - break; - default: - c = replacement ? '?' : 0; - } - } else { - c = replacement ? '?' : 0; - } - } - return c; -} - - -void TQLatin15Codec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const -{ - while ( length-- ) { - *out = latin15CharFromUnicode( in->unicode(), FALSE ); - ++in; - ++out; - } -} - - -TQCString TQLatin15Codec::fromUnicode(const TQString& uc, int& len ) const -{ - if ( len <0 || len > (int)uc.length() ) - len = uc.length(); - TQCString r( len+1 ); - char *d = r.data(); - int i = 0; - const TQChar *ch = uc.unicode(); - while ( i < len ) { - d[i] = latin15CharFromUnicode( ch->unicode() ); - i++; - ch++; - } - r[len] = 0; - return r; -} - -unsigned short TQLatin15Codec::characterFromUnicode(const TQString &str, int pos) const -{ - return latin15CharFromUnicode( str.unicode()[pos].unicode(), FALSE ); -} - - -const char* TQLatin15Codec::name() const -{ - return "ISO 8859-15"; -} - -const char* TQLatin15Codec::mimeName() const -{ - return "ISO-8859-15"; -} - - -int TQLatin15Codec::mibEnum() const -{ - return 111; -} - -static TQTextCodec *checkForCodec(const char *name) { - TQTextCodec *c = TQTextCodec::codecForName(name); - if (!c) { - const char *at = strchr(name, '@'); - if (at) { - TQCString n(name, at - name + 1); - c = TQTextCodec::codecForName(n.data()); - } - } - return c; -} - -/* the next function is implicitely thread safe, - as they are only called by setup() which uses a mutex. -*/ -static void setupLocaleMapper() -{ -#ifdef Q_OS_WIN32 - localeMapper = TQTextCodec::codecForName( "System" ); -#else - -#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX6) && !defined(Q_OS_OSF) && !defined(Q_OS_MAC) - char *charset = nl_langinfo (CODESET); - if ( charset ) - localeMapper = TQTextCodec::codecForName( charset ); -#endif - - if ( !localeMapper ) { - // Very poorly defined and followed standards causes lots of code - // to try to get all the cases... - - // Try to determine locale codeset from locale name assigned to - // LC_CTYPE category. - - // First part is getting that locale name. First try setlocale() which - // definitely knows it, but since we cannot fully trust it, get ready - // to fall back to environment variables. - char * ctype = tqstrdup( setlocale( LC_CTYPE, 0 ) ); - - // Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG - // environment variables. - char * lang = tqstrdup( getenv("LC_ALL") ); - if ( !lang || lang[0] == 0 || strcmp( lang, "C" ) == 0 ) { - if ( lang ) delete [] lang; - lang = tqstrdup( getenv("LC_CTYPE") ); - } - if ( !lang || lang[0] == 0 || strcmp( lang, "C" ) == 0 ) { - if ( lang ) delete [] lang; - lang = tqstrdup( getenv("LANG") ); - } - - // Now try these in order: - // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15) - // 2. CODESET from lang if it contains a .CODESET part - // 3. ctype (maybe the locale is named "ISO-8859-1" or something) - // 4. locale (ditto) - // 5. check for "@euro" - // 6. guess locale from ctype unless ctype is "C" - // 7. guess locale from lang - - // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15) - char * codeset = ctype ? strchr( ctype, '.' ) : 0; - if ( codeset && *codeset == '.' ) - localeMapper = checkForCodec( codeset + 1 ); - - // 2. CODESET from lang if it contains a .CODESET part - codeset = lang ? strchr( lang, '.' ) : 0; - if ( !localeMapper && codeset && *codeset == '.' ) - localeMapper = checkForCodec( codeset + 1 ); - - // 3. ctype (maybe the locale is named "ISO-8859-1" or something) - if ( !localeMapper && ctype && *ctype != 0 && strcmp (ctype, "C") != 0 ) - localeMapper = checkForCodec( ctype ); - - // 4. locale (ditto) - if ( !localeMapper && lang && *lang != 0 ) - localeMapper = checkForCodec( lang ); - - // 5. "@euro" - if ( ( !localeMapper && ctype && strstr( ctype, "@euro" ) ) || (lang && strstr( lang, "@euro" ) ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-15" ); - - // 6. guess locale from ctype unless ctype is "C" - // 7. guess locale from lang - char * try_by_name = ctype; - if ( ctype && *ctype != 0 && strcmp (ctype, "C") != 0 ) - try_by_name = lang; - - // Now do the guessing. - if ( lang && *lang && !localeMapper && try_by_name && *try_by_name ) { - if ( try_locale_list( iso8859_15locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-15" ); - else if ( try_locale_list( iso8859_2locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-2" ); - else if ( try_locale_list( iso8859_3locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-3" ); - else if ( try_locale_list( iso8859_4locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-4" ); - else if ( try_locale_list( iso8859_5locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-5" ); - else if ( try_locale_list( iso8859_6locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-6" ); - else if ( try_locale_list( iso8859_7locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-7" ); - else if ( try_locale_list( iso8859_8locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-8-I" ); - else if ( try_locale_list( iso8859_9locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-9" ); - else if ( try_locale_list( iso8859_13locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-13" ); - else if ( try_locale_list( tis_620locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-11" ); - else if ( try_locale_list( koi8_ulocales, lang ) ) - localeMapper = TQTextCodec::codecForName( "KOI8-U" ); - else if ( try_locale_list( cp_1251locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "CP 1251" ); - else if ( try_locale_list( pt_154locales, lang ) ) - localeMapper = TQTextCodec::codecForName( "PT 154" ); - else if ( try_locale_list( probably_koi8_rlocales, lang ) ) - localeMapper = ru_RU_hack( lang ); - } - - delete [] ctype; - delete [] lang; - } - if ( localeMapper && localeMapper->mibEnum() == 11 ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-8-I" ); - - // If everything failed, we default to 8859-1 - // We could perhaps default to 8859-15. - if ( !localeMapper ) - localeMapper = TQTextCodec::codecForName( "ISO 8859-1" ); -#endif -} - - -static void setup() -{ -#if defined(QT_CHECK_STATE) - if ( codecs_destroyed ) - { - // If codecs have been destroyed, the application is being destroyed. - // Do not create new codecs since this could lead to SEGV while trying to - // print a message using tqWarning/tqDebug/tqFatal at this stage - // - // Note: the use of `printf` instead of `tqWarning` is intentional. We should never - // get to this line of code. If we do, we are in some strange exception that we - // didn't think of. Using `tqWarning` could potentially lead to an infinite loop with - // `tqWarning` trying to setup codecs and this method calling `tqWarning` again. - // Using `printf` makes sure this never happens, even for exceptions we didn't foresee. - printf("TQTextCodec: setup() called when codecs have already been destroyed\n"); fflush(stdout); - return; - } -#endif - - if ( all ) return; - -#ifdef TQT_THREAD_SUPPORT - TQMutexLocker locker( tqt_global_mutexpool ? - tqt_global_mutexpool->get( &all ) : 0 ); -#endif // TQT_THREAD_SUPPORT - - all = new TQValueList<TQTextCodec*>; - - (void)new TQLatin1Codec; - (void)new TQLatin15Codec; - (void)new TQUtf8Codec; - (void)new TQUtf16Codec; - -#ifndef TQT_NO_CODECS - int i = 0; - do { - (void)new TQSimpleTextCodec( i ); - } while( unicodevalues[i++].mib != LAST_MIB ); - - (void)new TQTsciiCodec; - - for (i = 0; i < 9; ++i) { - (void)new TQIsciiCodec(i); - } -#endif // TQT_NO_CODECS -#ifndef TQT_NO_CODEC_HEBREW - (void)new TQHebrewCodec; -#endif -#ifndef TQT_NO_BIG_CODECS - (void)new TQBig5Codec; - (void)new TQBig5hkscsCodec; - (void)new TQEucJpCodec; - (void)new TQEucKrCodec; - (void)new TQGb2312Codec; - (void)new TQGbkCodec; - (void)new TQGb18030Codec; - (void)new TQJisCodec; - (void)new TQSjisCodec; -#endif // TQT_NO_BIG_CODECS - -#ifdef Q_OS_WIN32 - (void) new TQWindowsLocalCodec; -#endif // Q_OS_WIN32 - - if ( !localeMapper ) - setupLocaleMapper(); -} - -void TQTextCodec::fromUnicodeInternal( const TQChar *in, unsigned short *out, int length ) -{ - switch( mibEnum() ) { -#ifndef TQT_NO_CODECS - case 2084: - case 2088: - case 5: - case 6: - case 7: - case 8: - case 82: - case 10: - case 85: - case 12: - case 13: - case 109: - case 110: - case 2004: - case 2009: - case 2086: - case 2250: - case 2251: - case 2252: - case 2253: - case 2254: - case 2255: - case 2256: - case 2257: - case 2258: - case 2259: - ((TQSimpleTextCodec *)this)->fromUnicode( in, out, length ); - break; - -#if !defined(TQT_NO_BIG_CODECS) && defined(TQ_WS_X11) - // the TQFont*Codecs are only used on X11 - - case 15: - ((TQFontJis0201Codec *) this)->fromUnicode( in, out, length ); - break; - - case 63: - ((TQFontJis0208Codec *) this)->fromUnicode( in, out, length ); - break; - - case 36: - ((TQFontKsc5601Codec *) this)->fromUnicode( in, out, length ); - break; - - case 57: - ((TQFontGb2312Codec *) this)->fromUnicode( in, out, length ); - break; - - case -113: - ((TQFontGbkCodec *) this)->fromUnicode( in, out, length ); - break; - - case -114: - ((TQFontGb18030_0Codec *) this)->fromUnicode( in, out, length ); - break; - - case -2026: - ((TQFontBig5Codec *) this)->fromUnicode( in, out, length ); - break; - - case -2101: - ((TQFontBig5hkscsCodec *) this)->fromUnicode( in, out, length ); - break; - - case -4242: - ((TQFontLaoCodec *) this)->fromUnicode( in, out, length ); - break; -#endif -#endif // TQT_NO_CODECS - - case 4: - ((TQLatin1Codec *) this)->fromUnicode( in, out, length ); - break; - - case 111: - ((TQLatin15Codec *) this)->fromUnicode( in, out, length ); - break; - - default: - { - TQConstString string( in, length ); - TQString str = string.string(); - for ( int i = 0; i < length; i++ ) - out[i] = characterFromUnicode( str, i ); - } - } -} - - -/*! - \fn TQTextCodec* TQTextCodec::codecForTr() - - Returns the codec used by TQObject::tr() on its argument. If this - function returns 0 (the default), tr() assumes Latin-1. - - \sa setCodecForTr() -*/ - -/*! - \fn void TQTextCodec::setCodecForTr(TQTextCodec *c) - \nonreentrant - - Sets the codec used by TQObject::tr() on its argument to \a c. If - \a c is 0 (the default), tr() assumes Latin-1. - - If the literal quoted text in the program is not in the Latin-1 - encoding, this function can be used to set the appropriate - encoding. For example, software developed by Korean programmers - might use eucKR for all the text in the program, in which case the - main() function might look like this: - - \code - int main(int argc, char** argv) - { - TQApplication app(argc, argv); - ... install any additional codecs ... - TQTextCodec::setCodecForTr( TQTextCodec::codecForName("eucKR") ); - ... - } - \endcode - - Note that this is not the way to select the encoding that the \e - user has chosen. For example, to convert an application containing - literal English strings to Korean, all that is needed is for the - English strings to be passed through tr() and for translation - files to be loaded. For details of internationalization, see the - \link i18n.html TQt internationalization documentation\endlink. - - \sa codecForTr(), setCodecForTr(), setCodecForCStrings() -*/ - - -/*! - \fn TQTextCodec* TQTextCodec::codecForCStrings() - - Returns the codec used by TQString to convert to and from const - char* and TQCStrings. If this function returns 0 (the default), - TQString assumes Latin-1. - - \sa setCodecForCStrings() -*/ - -/*! - \fn void TQTextCodec::setCodecForCStrings(TQTextCodec *c) - \nonreentrant - - Sets the codec used by TQString to convert to and from const char* - and TQCStrings. If \a c is 0 (the default), TQString assumes Latin-1. - - \warning Some codecs do not preserve the characters in the ascii - range (0x00 to 0x7f). For example, the Japanese Shift-JIS - encoding maps the backslash character (0x5a) to the Yen character. - This leads to unexpected results when using the backslash - character to escape characters in strings used in e.g. regular - expressions. Use TQString::fromLatin1() to preserve characters in - the ascii range when needed. - - \sa codecForCStrings(), setCodecForTr(), setCodecForCStrings() -*/ - - -TQTextCodec *TQTextCodec::cftr = 0; -TQTextCodec *TQTextCodec::cfcs = 0; - - -#endif // TQT_NO_TEXTCODEC diff --git a/src/codecs/qtextcodecfactory.cpp b/src/codecs/qtextcodecfactory.cpp deleted file mode 100644 index 6a570157..00000000 --- a/src/codecs/qtextcodecfactory.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQTextCodecFactory class -** -** Created : 010130 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqtextcodecfactory.h" - -#ifndef TQT_NO_TEXTCODEC - -#ifndef TQT_NO_COMPONENT -#include "ntqapplication.h" -#include "ntqcleanuphandler.h" -#include <private/qpluginmanager_p.h> -#include "qtextcodecinterface_p.h" - -#ifdef TQT_THREAD_SUPPORT -# include <private/qmutexpool_p.h> -#endif // TQT_THREAD_SUPPORT - -#include <stdlib.h> - - -static TQPluginManager<TQTextCodecFactoryInterface> *manager = 0; -static TQSingleCleanupHandler< TQPluginManager<TQTextCodecFactoryInterface> > cleanup_manager; - -static void create_manager() -{ - if ( manager ) // already created - return; - -#ifdef TQT_THREAD_SUPPORT - // protect manager creation - TQMutexLocker locker( tqt_global_mutexpool ? - tqt_global_mutexpool->get( &manager ) : 0); - - // we check the manager pointer again to make sure that another thread - // has not created the manager before us. - - if ( manager ) // already created - return; -#endif - - manager = - new TQPluginManager<TQTextCodecFactoryInterface>(IID_QTextCodecFactory, - TQApplication::libraryPaths(), "/codecs", - FALSE); - TQ_CHECK_PTR( manager ); - cleanup_manager.set( &manager ); -} - -#endif // TQT_NO_COMPONENT - - -TQTextCodec *TQTextCodecFactory::createForName(const TQString &name) -{ - TQTextCodec *codec = 0; - -#ifndef TQT_NO_COMPONENT - - // make sure the manager is created - create_manager(); - - TQInterfacePtr<TQTextCodecFactoryInterface> iface; - manager->queryInterface(name, &iface ); - - if (iface) - codec = iface->createForName(name); - -#endif // TQT_NO_COMPONENT - - return codec; -} - - -TQTextCodec *TQTextCodecFactory::createForMib(int mib) -{ - TQTextCodec *codec = 0; - -#ifndef TQT_NO_COMPONENT - - // make sure the manager is created - create_manager(); - - TQInterfacePtr<TQTextCodecFactoryInterface> iface; - manager->queryInterface("MIB-" + TQString::number(mib), &iface ); - - if (iface) - codec = iface->createForMib(mib); - -#endif // TQT_NO_COMPONENT - - return codec; -} - - -#endif // TQT_NO_TEXTCODEC diff --git a/src/codecs/qtextcodecinterface_p.h b/src/codecs/qtextcodecinterface_p.h deleted file mode 100644 index 5a8baa04..00000000 --- a/src/codecs/qtextcodecinterface_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Definition of TQTextCodecFactoryInterface interface -** -** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTCODECINTERFACE_P_H -#define TQTEXTCODECINTERFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the TQt API. It exists for the convenience -// of qpsprinter.cpp and qprinter_x11.cpp. -// This header file may change from version to version without notice, -// or even be removed. -// -// We mean it. -// -// - -#ifndef QT_H -#include <private/qcom_p.h> -#endif // QT_H - -#ifndef TQT_NO_TEXTCODEC -#ifndef TQT_NO_COMPONENT - -class TQTextCodec; - - -// {F55BFA60-F695-11D4-823E-009027DC0F37} -#ifndef IID_QTextCodecFactory -#define IID_QTextCodecFactory TQUuid( 0xf55bfa60, 0xf695, 0x11d4, 0x82, 0x3e, 0x00, 0x90, 0x27, 0xdc, 0x0f, 0x37) -#endif - - -struct TQ_EXPORT TQTextCodecFactoryInterface : public TQFeatureListInterface -{ - virtual TQTextCodec *createForMib( int mib ) = 0; - virtual TQTextCodec *createForName( const TQString &name ) = 0; -}; - -#endif // TQT_NO_COMPONENT -#endif // TQT_NO_TEXTCODEC - -#endif // TQTEXTCODECINTERFACE_P_H diff --git a/src/codecs/qtextcodecplugin.cpp b/src/codecs/qtextcodecplugin.cpp deleted file mode 100644 index d59e8684..00000000 --- a/src/codecs/qtextcodecplugin.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQTextCodecPlugin class -** -** Created : 010920 -** -** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqtextcodecplugin.h" -#ifndef TQT_NO_TEXTCODECPLUGIN -#include "qtextcodecinterface_p.h" - -/*! - \class TQTextCodecPlugin ntqtextcodecplugin.h - \brief The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. - \reentrant - \ingroup plugins - - The text codec plugin is a simple plugin interface that makes it - easy to create custom text codecs that can be loaded dynamically - into applications. - - Writing a text codec plugin is achieved by subclassing this base - class, reimplementing the pure virtual functions names(), - createForName(), mibEnums() and createForMib(), and exporting the - class with the \c TQ_EXPORT_PLUGIN macro. See the \link - plugins-howto.html TQt Plugins documentation \endlink for details. - - See the \link http://www.iana.org/assignments/character-sets IANA - character-sets encoding file\endlink for more information on mime - names and mib enums. -*/ - -/*! - \fn TQStringList TQTextCodecPlugin::names() const - - Returns the list of mime names supported by this plugin. - - \sa createForName() -*/ - -/*! - \fn TQTextCodec *TQTextCodecPlugin::createForName( const TQString &name ); - - Creates a TQTextCodec object for the codec called \a name. - - \sa names() -*/ - - -/*! - \fn TQValueList<int> TQTextCodecPlugin::mibEnums() const - - Returns the list of mib enums supported by this plugin. - - \sa createForMib() -*/ - -/*! - \fn TQTextCodec *TQTextCodecPlugin::createForMib( int mib ); - - Creates a TQTextCodec object for the mib enum \a mib. - - (See \link - ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets the - IANA character-sets encoding file\endlink for more information) - - \sa mibEnums() -*/ - - - -class TQTextCodecPluginPrivate : public TQTextCodecFactoryInterface -{ -public: - TQTextCodecPluginPrivate( TQTextCodecPlugin *p ) - : plugin( p ) - { - } - virtual ~TQTextCodecPluginPrivate(); - - TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface ); - TQ_REFCOUNT; - - TQStringList featureList() const; - TQTextCodec *createForMib( int mib ); - TQTextCodec *createForName( const TQString &name ); - -private: - TQTextCodecPlugin *plugin; -}; - -TQTextCodecPluginPrivate::~TQTextCodecPluginPrivate() -{ - delete plugin; -} - -TQRESULT TQTextCodecPluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) -{ - *iface = 0; - - if ( iid == IID_QUnknown ) - *iface = this; - else if ( iid == IID_QFeatureList ) - *iface = this; - else if ( iid == IID_QTextCodecFactory ) - *iface = this; - else - return TQE_NOINTERFACE; - - (*iface)->addRef(); - return TQS_OK; -} - -TQStringList TQTextCodecPluginPrivate::featureList() const -{ - TQStringList keys = plugin->names(); - TQValueList<int> mibs = plugin->mibEnums(); - for ( TQValueList<int>::Iterator it = mibs.begin(); it != mibs.end(); ++it ) - keys += TQString("MIB-%1").arg( *it ); - return keys; -} - -TQTextCodec *TQTextCodecPluginPrivate::createForMib( int mib ) -{ - return plugin->createForMib( mib ); -} - -TQTextCodec *TQTextCodecPluginPrivate::createForName( const TQString &name ) -{ - return plugin->createForName( name ); -} - - -/*! - Constructs a text codec plugin. This is invoked automatically by - the \c TQ_EXPORT_PLUGIN macro. -*/ -TQTextCodecPlugin::TQTextCodecPlugin() - : TQGPlugin( d = new TQTextCodecPluginPrivate( this ) ) -{ -} - -/*! - Destroys the text codec plugin. - - You never have to call this explicitly. TQt destroys a plugin - automatically when it is no longer used. -*/ -TQTextCodecPlugin::~TQTextCodecPlugin() -{ -} - -#endif // TQT_NO_TEXTCODECPLUGIN diff --git a/src/codecs/tqtextcodec.cpp b/src/codecs/tqtextcodec.cpp new file mode 100644 index 00000000..cf7c6b93 --- /dev/null +++ b/src/codecs/tqtextcodec.cpp @@ -0,0 +1,3161 @@ +/**************************************************************************** +** +** Implementation of TQTextCodec class +** +** Created : 981015 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "qplatformdefs.h" + +// UNIX Large File Support redefines open -> open64 +#if defined(open) +# undef open +#endif + +#include "tqtextcodec.h" +#ifndef TQT_NO_TEXTCODEC + +#include "tqvaluelist.h" +#include "tqtextcodecfactory.h" +#include "ntqutfcodec.h" +#include "ntqnamespace.h" +#ifndef TQT_NO_CODECS +#include "ntqrtlcodec.h" +#include "ntqtsciicodec.h" +#include "qisciicodec_p.h" +#endif // TQT_NO_CODECS +#ifndef TQT_NO_BIG_CODECS +#include "ntqbig5codec.h" +#include "ntqeucjpcodec.h" +#include "ntqeuckrcodec.h" +#include "ntqgb18030codec.h" +#include "ntqjiscodec.h" +#include "ntqjpunicode.h" +#include "ntqsjiscodec.h" +#endif // TQT_NO_BIG_CODECS +#include "ntqfile.h" +#include "tqstrlist.h" +#include "tqstring.h" +#include "../tools/qlocale_p.h" + +#if !defined(TQT_NO_CODECS) && !defined(TQT_NO_BIG_CODECS) && defined(TQ_WS_X11) +# include "qfontcodecs_p.h" +#endif + +#ifdef TQT_THREAD_SUPPORT +# include <private/qmutexpool_p.h> +#endif // TQT_THREAD_SUPPORT + +#include <stdlib.h> +#include <ctype.h> +#ifndef Q_OS_TEMP +#include <locale.h> +#endif +#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX6) +#include <langinfo.h> +#endif + +static TQValueList<TQTextCodec*> *all = 0; +static bool codecs_destroyed = false; +static TQTextCodec * localeMapper = 0; + +class TQTextCodecCleanup { +public: + ~TQTextCodecCleanup() { + TQTextCodec::deleteAllCodecs(); + } +}; +static TQTextCodecCleanup tqtextcodec_cleanup; + +/*! + Deletes all the created codecs. + + \warning Do not call this function. + + TQApplication calls this function just before exiting to delete + any TQTextCodec objects that may be lying around. Since various + other classes hold pointers to TQTextCodec objects, it is not safe + to call this function earlier. + + If you are using the utility classes (like TQString) but not using + TQApplication, calling this function at the very end of your + application may be helpful for chasing down memory leaks by + eliminating any TQTextCodec objects. +*/ + +void TQTextCodec::deleteAllCodecs() +{ + codecs_destroyed = true; + + if ( !all ) + return; + +#ifdef TQT_THREAD_SUPPORT + TQMutexLocker locker( tqt_global_mutexpool ? + tqt_global_mutexpool->get( &all ) : 0 ); +#endif // TQT_THREAD_SUPPORT + + TQValueList<TQTextCodec*> *ball = all; + all = 0; + TQValueList<TQTextCodec*>::Iterator it; + for ( it = ball->begin(); it != ball->end(); ++it ) { + delete *it; + *it = 0; + } + ball->clear(); + delete ball; + + localeMapper = 0; +} + +static void setup(); + +class TQTextStatelessEncoder: public TQTextEncoder { + const TQTextCodec* codec; +public: + TQTextStatelessEncoder(const TQTextCodec*); + TQCString fromUnicode(const TQString& uc, int& lenInOut); +}; + + +class TQTextStatelessDecoder : public TQTextDecoder { + const TQTextCodec* codec; +public: + TQTextStatelessDecoder(const TQTextCodec*); + TQString toUnicode(const char* chars, int len); +}; + +TQTextStatelessEncoder::TQTextStatelessEncoder(const TQTextCodec* c) : + codec(c) +{ +} + + +TQCString TQTextStatelessEncoder::fromUnicode(const TQString& uc, int& lenInOut) +{ + return codec->fromUnicode(uc,lenInOut); +} + + +TQTextStatelessDecoder::TQTextStatelessDecoder(const TQTextCodec* c) : + codec(c) +{ +} + + +TQString TQTextStatelessDecoder::toUnicode(const char* chars, int len) +{ + return codec->toUnicode(chars,len); +} + + + +/*! + \class TQTextCodec tqtextcodec.h + \brief The TQTextCodec class provides conversion between text encodings. + \reentrant + \ingroup i18n + + TQt uses Unicode to store, draw and manipulate strings. In many + situations you may wish to deal with data that uses a different + encoding. For example, most Japanese documents are still stored in + Shift-JIS or ISO2022, while Russian users often have their + documents in KOI8-R or CP1251. + + TQt provides a set of TQTextCodec classes to help with converting + non-Unicode formats to and from Unicode. You can also create your + own codec classes (\link #subclassing see later\endlink). + + The supported encodings are: + \list + \i Latin1 + \i Big5 -- Chinese + \i Big5-HKSCS -- Chinese + \i eucJP -- Japanese + \i eucKR -- Korean + \i GB2312 -- Chinese + \i GBK -- Chinese + \i GB18030 -- Chinese + \i JIS7 -- Japanese + \i Shift-JIS -- Japanese + \i TSCII -- Tamil + \i utf8 -- Unicode, 8-bit + \i utf16 -- Unicode + \i KOI8-R -- Russian + \i KOI8-U -- Ukrainian + \i ISO8859-1 -- Western + \i ISO8859-2 -- Central European + \i ISO8859-3 -- Central European + \i ISO8859-4 -- Baltic + \i ISO8859-5 -- Cyrillic + \i ISO8859-6 -- Arabic + \i ISO8859-7 -- Greek + \i ISO8859-8 -- Hebrew, visually ordered + \i ISO8859-8-i -- Hebrew, logically ordered + \i ISO8859-9 -- Turkish + \i ISO8859-10 + \i ISO8859-13 + \i ISO8859-14 + \i ISO8859-15 -- Western + \i IBM 850 + \i IBM 866 + \i CP874 + \i CP1250 -- Central European + \i CP1251 -- Cyrillic + \i CP1252 -- Western + \i CP1253 -- Greek + \i CP1254 -- Turkish + \i CP1255 -- Hebrew + \i CP1256 -- Arabic + \i CP1257 -- Baltic + \i CP1258 + \i Apple Roman + \i TIS-620 -- Thai + \endlist + + TQTextCodecs can be used as follows to convert some locally encoded + string to Unicode. Suppose you have some string encoded in Russian + KOI8-R encoding, and want to convert it to Unicode. The simple way + to do this is: + + \code + TQCString locallyEncoded = "..."; // text to convert + TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R + TQString unicodeString = codec->toUnicode( locallyEncoded ); + \endcode + + After this, \c{unicodeString} holds the text converted to Unicode. + Converting a string from Unicode to the local encoding is just as + easy: + + \code + TQString unicodeString = "..."; // any Unicode text + TQTextCodec *codec = TQTextCodec::codecForName("KOI8-R"); // get the codec for KOI8-R + TQCString locallyEncoded = codec->fromUnicode( unicodeString ); + \endcode + + Some care must be taken when trying to convert the data in chunks, + for example, when receiving it over a network. In such cases it is + possible that a multi-byte character will be split over two + chunks. At best this might result in the loss of a character and + at worst cause the entire conversion to fail. + + The approach to use in these situations is to create a TQTextDecoder + object for the codec and use this TQTextDecoder for the whole + decoding process, as shown below: + + \code + TQTextCodec *codec = TQTextCodec::codecForName( "Shift-JIS" ); + TQTextDecoder *decoder = codec->makeDecoder(); + + TQString unicodeString; + while( receiving_data ) { + TQByteArray chunk = new_data; + unicodeString += decoder->toUnicode( chunk.data(), chunk.length() ); + } + \endcode + + The TQTextDecoder object maintains state between chunks and therefore + works correctly even if a multi-byte character is split between + chunks. + + \target subclassing + \section1 Creating your own Codec class + + Support for new text encodings can be added to TQt by creating + TQTextCodec subclasses. + + Built-in codecs can be overridden by custom codecs since more + recently created TQTextCodec objects take precedence over earlier + ones. + + You may find it more convenient to make your codec class available + as a plugin; see the \link plugins-howto.html plugin + documentation\endlink for more details. + + The abstract virtual functions describe the encoder to the + system and the coder is used as required in the different + text file formats supported by TQTextStream, and under X11, for the + locale-specific character input and output. + + To add support for another 8-bit encoding to TQt, make a subclass + of TQTextCodec and implement at least the following methods: + + \code + const char* name() const + \endcode + Return the official name for the encoding. + + \code + int mibEnum() const + \endcode + Return the MIB enum for the encoding if it is listed in the + \link http://www.iana.org/assignments/character-sets + IANA character-sets encoding file\endlink. + + If the encoding is multi-byte then it will have "state"; that is, + the interpretation of some bytes will be dependent on some preceding + bytes. For such encodings, you must implement: + + \code + TQTextDecoder* makeDecoder() const + \endcode + Return a TQTextDecoder that remembers incomplete multi-byte sequence + prefixes or other required state. + + If the encoding does \e not require state, you should implement: + + \code + TQString toUnicode(const char* chars, int len) const + \endcode + Converts \e len characters from \e chars to Unicode. + + The base TQTextCodec class has default implementations of the above + two functions, \e{but they are mutually recursive}, so you must + re-implement at least one of them, or both for improved efficiency. + + For conversion from Unicode to 8-bit encodings, it is rarely necessary + to maintain state. However, two functions similar to the two above + are used for encoding: + + \code + TQTextEncoder* makeEncoder() const + \endcode + Return a TQTextEncoder. + + \code + TQCString fromUnicode(const TQString& uc, int& lenInOut ) const + \endcode + Converts \e lenInOut characters (of type TQChar) from the start of + the string \e uc, returning a TQCString result, and also returning + the \link TQCString::length() length\endlink of the result in + \e lenInOut. + + Again, these are mutually recursive so only one needs to be implemented, + or both if greater efficiency is possible. + + Finally, you must implement: + + \code + int heuristicContentMatch(const char* chars, int len) const + \endcode + Gives a value indicating how likely it is that \e len characters + from \e chars are in the encoding. + + A good model for this function is the + TQWindowsLocalCodec::heuristicContentMatch function found in the TQt + sources. + + A TQTextCodec subclass might have improved performance if you also + re-implement: + + \code + bool canEncode( TQChar ) const + \endcode + Test if a Unicode character can be encoded. + + \code + bool canEncode( const TQString& ) const + \endcode + Test if a string of Unicode characters can be encoded. + + \code + int heuristicNameMatch(const char* hint) const + \endcode + Test if a possibly non-standard name is referring to the codec. + + Codecs can also be created as \link plugins-howto.html plugins\endlink. +*/ + + +/*! + \nonreentrant + + Constructs a TQTextCodec, and gives it the highest precedence. The + TQTextCodec should always be constructed on the heap (i.e. with \c + new). TQt takes ownership and will delete it when the application + terminates. +*/ +TQTextCodec::TQTextCodec() +{ + // 'codecs_destroyed' should never be true at this point + if (!codecs_destroyed) + { + setup(); +#ifdef TQT_THREAD_SUPPORT + TQMutexLocker locker( tqt_global_mutexpool ? + tqt_global_mutexpool->get( &all ) : 0 ); +#endif // TQT_THREAD_SUPPORT + all->insert( all->begin(), this ); + } +} + + +/*! + \nonreentrant + + Destroys the TQTextCodec. Note that you should not delete codecs + yourself: once created they become TQt's responsibility. +*/ +TQTextCodec::~TQTextCodec() +{ + if ( !codecs_destroyed ) + tqWarning("TQTextCodec::~TQTextCodec() called by application"); + +#ifdef TQT_THREAD_SUPPORT + TQMutexLocker locker( tqt_global_mutexpool ? + tqt_global_mutexpool->get( &all ) : 0 ); +#endif // TQT_THREAD_SUPPORT + if ( all ) + all->remove( this ); +} + + +/*! + Returns a value indicating how likely it is that this decoder is + appropriate for decoding some format that has the given name. The + name is compared with the \a hint. + + A good match returns a positive number around the length of the + string. A bad match is negative. + + The default implementation calls simpleHeuristicNameMatch() with + the name of the codec. +*/ +int TQTextCodec::heuristicNameMatch(const char* hint) const +{ + return simpleHeuristicNameMatch(name(),hint); +} + + +// returns a string containing the letters and numbers from input, +// with a space separating run of a character class. e.g. "iso8859-1" +// becomes "iso 8859 1" +static TQString lettersAndNumbers( const char * input ) +{ + TQString result; + TQChar c; + + while( input && *input ) { + c = *input; + if ( c.isLetter() || c.isNumber() ) + result += c.lower(); + if ( input[1] ) { + // add space at character class transition, except + // transition from upper-case to lower-case letter + TQChar n( input[1] ); + if ( c.isLetter() && n.isLetter() ) { + if ( c == c.lower() && n == n.upper() ) + result += ' '; + } else if ( c.category() != n.category() ) { + result += ' '; + } + } + input++; + } + return result.simplifyWhiteSpace(); +} + +/*! + A simple utility function for heuristicNameMatch(): it does some + very minor character-skipping so that almost-exact matches score + high. \a name is the text we're matching and \a hint is used for + the comparison. +*/ +int TQTextCodec::simpleHeuristicNameMatch(const char* name, const char* hint) +{ + // if they're the same, return a perfect score. + if ( name && hint && *name && *hint && tqstricmp( name, hint ) == 0 ) + return tqstrlen( hint ); + + // if the letters and numbers are the same, we have an "almost" + // perfect match. + TQString h( lettersAndNumbers( hint ) ); + TQString n( lettersAndNumbers( name ) ); + if ( h == n ) + return tqstrlen( hint )-1; + + if ( h.stripWhiteSpace() == n.stripWhiteSpace() ) + return tqstrlen( hint )-2; + + // could do some more here, but I don't think it's worth it + + return 0; +} + + +/*! + Returns the TQTextCodec \a i positions from the most recently + inserted codec, or 0 if there is no such TQTextCodec. Thus, + codecForIndex(0) returns the most recently created TQTextCodec. +*/ +TQTextCodec* TQTextCodec::codecForIndex(int i) +{ + if (codecs_destroyed) + { + return nullptr; + } + + setup(); + return (uint)i >= all->count() ? 0 : *all->at(i); +} + + +/*! + Returns the TQTextCodec which matches the \link + TQTextCodec::mibEnum() MIBenum\endlink \a mib. +*/ +TQTextCodec* TQTextCodec::codecForMib(int mib) +{ + if (codecs_destroyed) + { + return nullptr; + } + + setup(); + TQValueList<TQTextCodec*>::ConstIterator i; + TQTextCodec* result=0; + for ( i = all->begin(); i != all->end(); ++i ) { + result = *i; + if ( result->mibEnum()==mib ) + return result; + } + +#if !defined(TQT_NO_COMPONENT) && !defined(QT_LITE_COMPONENT) + if ( !result || (result && result->mibEnum() != mib) ) { + TQTextCodec *codec = TQTextCodecFactory::createForMib(mib); + if (codec) + result = codec; + } +#endif // !TQT_NO_COMPONENT !QT_LITE_COMPONENT + + return result; +} + + + + + +#ifdef Q_OS_WIN32 +class TQWindowsLocalCodec: public TQTextCodec +{ +public: + TQWindowsLocalCodec(); + ~TQWindowsLocalCodec(); + + TQString toUnicode(const char* chars, int len) const; + TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; + + const char* name() const; + int mibEnum() const; + + int heuristicContentMatch(const char* chars, int len) const; + + TQTextDecoder* makeDecoder() const; +}; + +TQWindowsLocalCodec::TQWindowsLocalCodec() +{ +} + +TQWindowsLocalCodec::~TQWindowsLocalCodec() +{ +} + + +TQString TQWindowsLocalCodec::toUnicode(const char* chars, int len) const +{ + if ( len == 1 && chars ) { // Optimization; avoids allocation + char c[2]; + c[0] = *chars; + c[1] = 0; + return qt_winMB2TQString( c, 2 ); + } + if ( len < 0 ) + return qt_winMB2TQString( chars ); + TQCString s(chars,len+1); + return qt_winMB2TQString(s); +} + +TQCString TQWindowsLocalCodec::fromUnicode(const TQString& uc, int& lenInOut ) const +{ + TQCString r = qt_winTQString2MB( uc, lenInOut ); + lenInOut = r.length(); + return r; +} + + +const char* TQWindowsLocalCodec::name() const +{ + return "System"; +} + +int TQWindowsLocalCodec::mibEnum() const +{ + return 0; +} + + +int TQWindowsLocalCodec::heuristicContentMatch(const char* chars, int len) const +{ + // ### Not a bad default implementation? + TQString t = toUnicode(chars,len); + int l = t.length(); + TQCString mb = fromUnicode(t,l); + int i=0; + while ( i < len ) { + if ( chars[i] == mb[i] ) + i++; + else + break; + } + return i; +} + +class TQWindowsLocalDecoder: public TQTextDecoder +{ + const TQWindowsLocalCodec* codec; + int nbuf; + uchar buf[4]; // hopefully this will be enough +public: + TQWindowsLocalDecoder(const TQWindowsLocalCodec *c) : codec(c), nbuf(0) + { + } + + TQString toUnicode(const char* chars, int len) + { + if (len != 1 && nbuf == 0) + return codec->toUnicode(chars, len); + if (len == 1) { + char c[sizeof buf + 2]; + memcpy(c, buf, nbuf); + c[nbuf] = *chars; + c[nbuf+1] = 0; + + // try to decode this: + TQString retval = codec->toUnicode(c, -1); + if ( retval.isEmpty() ) { + // it didn't return anything; we probably stopped mid-way in a multi-byte + // character + buf[nbuf++] = *chars; + if (nbuf + 1 == sizeof buf) { + tqWarning("TQWindowsLocalDecoder: exceeded max internal buffer size"); + nbuf = 0; + } + } + else + nbuf = 0; // decoded successfully + + return retval; + } + + if (len == -1) + len = (int)strlen(chars); + + // Ugh! We need to allocate memory + char *s = new char[nbuf + len + 1]; + memcpy(s, buf, nbuf); + memcpy(s + nbuf, chars, len); + s[nbuf + len] = 0; + + TQString retval = codec->toUnicode(s, -1); + nbuf = 0; + delete[] s; + return retval; + } +}; + +TQTextDecoder* TQWindowsLocalCodec::makeDecoder() const +{ + return new TQWindowsLocalDecoder(this); +} + +#else + +/* locale names mostly copied from XFree86 */ +static const char * const iso8859_2locales[] = { + "croatian", "cs", "cs_CS", "cs_CZ","cz", "cz_CZ", "czech", "hr", + "hr_HR", "hu", "hu_HU", "hungarian", "pl", "pl_PL", "polish", "ro", + "ro_RO", "rumanian", "serbocroatian", "sh", "sh_SP", "sh_YU", "sk", + "sk_SK", "sl", "sl_CS", "sl_SI", "slovak", "slovene", "sr_SP", 0 }; + +static const char * const iso8859_3locales[] = { + "eo", 0 }; + +static const char * const iso8859_4locales[] = { + "ee", "ee_EE", 0 }; + +static const char * const iso8859_5locales[] = { + "mk", "mk_MK", "sp", "sp_YU", 0 }; + +static const char * const cp_1251locales[] = { + "be", "be_BY", "bg", "bg_BG", "bulgarian", 0 }; + +static const char * const pt_154locales[] = { + "ba_RU", "ky", "ky_KG", "kk", "kk_KZ", 0 }; + +static const char * const iso8859_6locales[] = { + "ar_AA", "ar_SA", "arabic", 0 }; + +static const char * const iso8859_7locales[] = { + "el", "el_GR", "greek", 0 }; + +static const char * const iso8859_8locales[] = { + "hebrew", "he", "he_IL", "iw", "iw_IL", 0 }; + +static const char * const iso8859_9locales[] = { + "tr", "tr_TR", "turkish", 0 }; + +static const char * const iso8859_13locales[] = { + "lt", "lt_LT", "lv", "lv_LV", 0 }; + +static const char * const iso8859_15locales[] = { + "et", "et_EE", + // Euro countries + "br_FR", "ca_ES", "de", "de_AT", "de_BE", "de_DE", "de_LU", "en_IE", + "es", "es_ES", "eu_ES", "fi", "fi_FI", "finnish", "fr", "fr_FR", + "fr_BE", "fr_LU", "french", "ga_IE", "gl_ES", "it", "it_IT", "oc_FR", + "nl", "nl_BE", "nl_NL", "pt", "pt_PT", "sv_FI", "wa_BE", + 0 }; + +static const char * const koi8_ulocales[] = { + "uk", "uk_UA", "ru_UA", "ukrainian", 0 }; + +static const char * const tis_620locales[] = { + "th", "th_TH", "thai", 0 }; + +static const char * const tcvnlocales[] = { + "vi", "vi_VN", 0 }; + +static bool try_locale_list( const char * const locale[], const char * lang ) +{ + int i; + for( i=0; locale[i] && *locale[i] && strcmp(locale[i], lang); i++ ) + ; + return locale[i] != 0; +} + +// For the probably_koi8_locales we have to look. the standard says +// these are 8859-5, but almost all Russian users use KOI8-R and +// incorrectly set $LANG to ru_RU. We'll check tolower() to see what +// tolower() thinks ru_RU means. + +// If you read the history, it seems that many Russians blame ISO and +// Perestroika for the confusion. +// +// The real bug is that some programs break if the user specifies +// ru_RU.KOI8-R. + +static const char * const probably_koi8_rlocales[] = { + "ru", "ru_SU", "ru_RU", "russian", 0 }; + +static TQTextCodec * ru_RU_hack( const char * i ) { + TQTextCodec * ru_RU_codec = 0; + + TQCString origlocale = setlocale( LC_CTYPE, i ); + // unicode koi8r latin5 name + // 0x044E 0xC0 0xEE CYRILLIC SMALL LETTER YU + // 0x042E 0xE0 0xCE CYRILLIC CAPITAL LETTER YU + int latin5 = tolower( 0xCE ); + int koi8r = tolower( 0xE0 ); + if ( koi8r == 0xC0 && latin5 != 0xEE ) { + ru_RU_codec = TQTextCodec::codecForName( "KOI8-R" ); + } else if ( koi8r != 0xC0 && latin5 == 0xEE ) { + ru_RU_codec = TQTextCodec::codecForName( "ISO 8859-5" ); + } else { + // something else again... let's assume... *throws dice* + ru_RU_codec = TQTextCodec::codecForName( "KOI8-R" ); + tqWarning( "TQTextCodec: using KOI8-R, probe failed (%02x %02x %s)", + koi8r, latin5, i ); + } + setlocale( LC_CTYPE, origlocale.data() ); + + return ru_RU_codec; +} + +#endif + +/*! + Set the codec to \a c; this will be returned by codecForLocale(). + This might be needed for some applications that want to use their + own mechanism for setting the locale. + + \sa codecForLocale() +*/ +void TQTextCodec::setCodecForLocale(TQTextCodec *c) { + localeMapper = c; +} + +/*! Returns a pointer to the codec most suitable for this locale. */ + +TQTextCodec* TQTextCodec::codecForLocale() +{ + if (codecs_destroyed) + { + return nullptr; + } + + if (!localeMapper) + { + setup(); + } + + return localeMapper; +} + + +/*! + Searches all installed TQTextCodec objects and returns the one + which best matches \a name; the match is case-insensitive. Returns + 0 if no codec's heuristicNameMatch() reports a match better than + \a accuracy, or if \a name is a null string. + + \sa heuristicNameMatch() +*/ + +TQTextCodec* TQTextCodec::codecForName( const char* name, int accuracy ) +{ + if (codecs_destroyed) + { + return nullptr; + } + + if ( !name || !*name ) + return 0; + + setup(); + TQValueList<TQTextCodec*>::ConstIterator i; + TQTextCodec* result = 0; + int best = accuracy; + TQTextCodec* cursor; + for ( i = all->begin(); i != all->end(); ++i ) { + cursor = *i; + int s = cursor->heuristicNameMatch( name ); + if ( s > best ) { + best = s; + result = cursor; + } + } + +#if !defined(TQT_NO_COMPONENT) && !defined(QT_LITE_COMPONENT) + if ( !result ) + result = TQTextCodecFactory::createForName(name); +#endif // !TQT_NO_COMPONENT !QT_LITE_COMPONENT + + return result; +} + + +/*! + Searches all installed TQTextCodec objects, returning the one which + most recognizes the given content. May return 0. + + Note that this is often a poor choice, since character encodings + often use most of the available character sequences, and so only + by linguistic analysis could a true match be made. + + \a chars contains the string to check, and \a len contains the + number of characters in the string to use. + + \sa heuristicContentMatch() +*/ +TQTextCodec* TQTextCodec::codecForContent(const char* chars, int len) +{ + if (codecs_destroyed) + { + return nullptr; + } + + setup(); + TQValueList<TQTextCodec*>::ConstIterator i; + TQTextCodec* result = 0; + int best=0; + TQTextCodec* cursor; + for ( i = all->begin(); i != all->end(); ++i ) { + cursor = *i; + int s = cursor->heuristicContentMatch(chars,len); + if ( s > best ) { + best = s; + result = cursor; + } + } + return result; +} + + +/*! + \fn const char* TQTextCodec::name() const + + TQTextCodec subclasses must reimplement this function. It returns + the name of the encoding supported by the subclass. When choosing + a name for an encoding, consider these points: + \list + \i On X11, heuristicNameMatch( const char * hint ) + is used to test if a the TQTextCodec + can convert between Unicode and the encoding of a font + with encoding \e hint, such as "iso8859-1" for Latin-1 fonts, + "koi8-r" for Russian KOI8 fonts. + The default algorithm of heuristicNameMatch() uses name(). + \i Some applications may use this function to present + encodings to the end user. + \endlist + */ + +/*! + \fn int TQTextCodec::mibEnum() const + + Subclasses of TQTextCodec must reimplement this function. It + returns the MIBenum (see \link + http://www.iana.org/assignments/character-sets the + IANA character-sets encoding file\endlink for more information). + It is important that each TQTextCodec subclass returns the correct + unique value for this function. +*/ + + +/*! + Returns the preferred mime name of the encoding as defined in the + \link http://www.iana.org/assignments/character-sets + IANA character-sets encoding file\endlink. +*/ +const char* TQTextCodec::mimeName() const +{ + return name(); +} + + +/*! + \fn int TQTextCodec::heuristicContentMatch(const char* chars, int len) const + + TQTextCodec subclasses must reimplement this function. It examines + the first \a len bytes of \a chars and returns a value indicating + how likely it is that the string is a prefix of text encoded in + the encoding of the subclass. A negative return value indicates + that the text is detectably not in the encoding (e.g. it contains + characters undefined in the encoding). A return value of 0 + indicates that the text should be decoded with this codec rather + than as ASCII, but there is no particular evidence. The value + should range up to \a len. Thus, most decoders will return -1, 0, + or -\a len. + + The characters are not null terminated. + + \sa codecForContent(). +*/ + + +/*! + Creates a TQTextDecoder which stores enough state to decode chunks + of char* data to create chunks of Unicode data. The default + implementation creates a stateless decoder, which is only + sufficient for the simplest encodings where each byte corresponds + to exactly one Unicode character. + + The caller is responsible for deleting the returned object. +*/ +TQTextDecoder* TQTextCodec::makeDecoder() const +{ + return new TQTextStatelessDecoder(this); +} + + +/*! + Creates a TQTextEncoder which stores enough state to encode chunks + of Unicode data as char* data. The default implementation creates + a stateless encoder, which is only sufficient for the simplest + encodings where each Unicode character corresponds to exactly one + character. + + The caller is responsible for deleting the returned object. +*/ +TQTextEncoder* TQTextCodec::makeEncoder() const +{ + return new TQTextStatelessEncoder(this); +} + + +/*! + TQTextCodec subclasses must reimplement this function or + makeDecoder(). It converts the first \a len characters of \a chars + to Unicode. + + The default implementation makes a decoder with makeDecoder() and + converts the input with that. Note that the default makeDecoder() + implementation makes a decoder that simply calls + this function, hence subclasses \e must reimplement one function or + the other to avoid infinite recursion. +*/ +TQString TQTextCodec::toUnicode(const char* chars, int len) const +{ + if ( chars == 0 ) + return TQString::null; + TQTextDecoder* i = makeDecoder(); + TQString result = i->toUnicode(chars,len); + delete i; + return result; +} + + +/*! + TQTextCodec subclasses must reimplement either this function or + makeEncoder(). It converts the first \a lenInOut characters of \a + uc from Unicode to the encoding of the subclass. If \a lenInOut is + negative or too large, the length of \a uc is used instead. + + Converts \a lenInOut characters (not bytes) from \a uc, producing + a TQCString. \a lenInOut will be set to the \link + TQCString::length() length\endlink of the result (in bytes). + + The default implementation makes an encoder with makeEncoder() and + converts the input with that. Note that the default makeEncoder() + implementation makes an encoder that simply calls this function, + hence subclasses \e must reimplement one function or the other to + avoid infinite recursion. +*/ + +TQCString TQTextCodec::fromUnicode(const TQString& uc, int& lenInOut) const +{ + TQTextEncoder* i = makeEncoder(); + TQCString result = i->fromUnicode(uc, lenInOut); + delete i; + return result; +} + +/*! + \overload + \internal +*/ +TQByteArray TQTextCodec::fromUnicode( const TQString &str, int pos, int len ) const +{ + TQByteArray a; + if( len < 0 ) + len = str.length() - pos; + a = fromUnicode( str.mid(pos, len) ); + if( a.size() > 0 && a[(int)a.size() - 1] == '\0' ) + a.resize( a.size() - 1 ); + return a; +} + +/*! + \overload + + \a uc is the unicode source string. +*/ +TQCString TQTextCodec::fromUnicode(const TQString& uc) const +{ + int l = uc.length(); + return fromUnicode(uc,l); +} + +/*! + \overload + + \a a contains the source characters; \a len contains the number of + characters in \a a to use. +*/ +TQString TQTextCodec::toUnicode(const TQByteArray& a, int len) const +{ + int l = a.size(); + l = TQMIN( l, len ); + return toUnicode( a.data(), l ); +} + +/*! + \overload + + \a a contains the source characters. +*/ +TQString TQTextCodec::toUnicode(const TQByteArray& a) const +{ + int l = a.size(); + return toUnicode( a.data(), l ); +} + +/*! + \overload + + \a a contains the source characters; \a len contains the number of + characters in \a a to use. +*/ +TQString TQTextCodec::toUnicode(const TQCString& a, int len) const +{ + int l = a.length(); + l = TQMIN( l, len ); + return toUnicode( a.data(), l ); +} + +/*! + \overload + + \a a contains the source characters. +*/ +TQString TQTextCodec::toUnicode(const TQCString& a) const +{ + int l = a.length(); + return toUnicode( a.data(), l ); +} + +/*! + \overload + + \a chars contains the source characters. +*/ +TQString TQTextCodec::toUnicode(const char* chars) const +{ + return toUnicode(chars,tqstrlen(chars)); +} + +/*! + \internal +*/ +unsigned short TQTextCodec::characterFromUnicode(const TQString &str, int pos) const +{ + TQCString result = TQTextCodec::fromUnicode(TQString(str[pos])); + uchar *ch = (uchar *) result.data(); + ushort retval = 0; + if (result.size() > 2) { + retval = (ushort) *ch << 8; + ch++; + } + return retval + *ch; +} + +/*! + Returns TRUE if the Unicode character \a ch can be fully encoded + with this codec; otherwise returns FALSE. The default + implementation tests if the result of toUnicode(fromUnicode(ch)) + is the original \a ch. Subclasses may be able to improve the + efficiency. +*/ +bool TQTextCodec::canEncode( TQChar ch ) const +{ + return toUnicode(fromUnicode(ch)) == ch; +} + +/*! + \overload + + \a s contains the string being tested for encode-ability. +*/ +bool TQTextCodec::canEncode( const TQString& s ) const +{ + if ( s.isEmpty() ) + return TRUE; + return toUnicode(fromUnicode(s)) == s; +} + + + +/*! + \class TQTextEncoder tqtextcodec.h + \brief The TQTextEncoder class provides a state-based encoder. + \reentrant + \ingroup i18n + + The encoder converts Unicode into another format, remembering any + state that is required between calls. + + \sa TQTextCodec::makeEncoder() +*/ + +/*! + Destroys the encoder. +*/ +TQTextEncoder::~TQTextEncoder() +{ +} + +/*! + \fn TQCString TQTextEncoder::fromUnicode(const TQString& uc, int& lenInOut) + + Converts \a lenInOut characters (not bytes) from \a uc, producing + a TQCString. \a lenInOut will be set to the \link + TQCString::length() length\endlink of the result (in bytes). + + The encoder is free to record state to use when subsequent calls + are made to this function (for example, it might change modes with + escape sequences if needed during the encoding of one string, then + assume that mode applies when a subsequent call begins). +*/ + +/*! + \class TQTextDecoder tqtextcodec.h + \brief The TQTextDecoder class provides a state-based decoder. + \reentrant + \ingroup i18n + + The decoder converts a text format into Unicode, remembering any + state that is required between calls. + + \sa TQTextCodec::makeEncoder() +*/ + + +/*! + Destroys the decoder. +*/ +TQTextDecoder::~TQTextDecoder() +{ +} + +/*! + \fn TQString TQTextDecoder::toUnicode(const char* chars, int len) + + Converts the first \a len bytes in \a chars to Unicode, returning + the result. + + If not all characters are used (e.g. if only part of a multi-byte + encoding is at the end of the characters), the decoder remembers + enough state to continue with the next call to this function. +*/ + +#define CHAINED 0xffff + +struct TQMultiByteUnicodeTable { + // If multiByte, ignore unicode and index into multiByte + // with the next character. + TQMultiByteUnicodeTable() : unicode(0xfffd), multiByte(0) { } + + ~TQMultiByteUnicodeTable() + { + if ( multiByte ) + delete [] multiByte; + } + + ushort unicode; + TQMultiByteUnicodeTable* multiByte; +}; + +static int getByte(char* &cursor) +{ + int byte = 0; + if ( *cursor ) { + if ( cursor[1] == 'x' ) + byte = strtol(cursor+2,&cursor,16); + else if ( cursor[1] == 'd' ) + byte = strtol(cursor+2,&cursor,10); + else + byte = strtol(cursor+2,&cursor,8); + } + return byte&0xff; +} + +class TQTextCodecFromIOD; + +class TQTextCodecFromIODDecoder : public TQTextDecoder { + const TQTextCodecFromIOD* codec; + TQMultiByteUnicodeTable* mb; +public: + TQTextCodecFromIODDecoder(const TQTextCodecFromIOD* c); + TQString toUnicode(const char* chars, int len); +}; + +class TQTextCodecFromIOD : public TQTextCodec { + friend class TQTextCodecFromIODDecoder; + + TQCString n; + + // If from_unicode_page[row()][cell()] is 0 and from_unicode_page_multiByte, + // use from_unicode_page_multiByte[row()][cell()] as string. + char** from_unicode_page; + char*** from_unicode_page_multiByte; + char unkn; + + // Only one of these is used + ushort* to_unicode; + TQMultiByteUnicodeTable* to_unicode_multiByte; + int max_bytes_per_char; + TQStrList aliases; + + bool stateless() const { return !to_unicode_multiByte; } + +public: + TQTextCodecFromIOD(TQIODevice* iod) + { + from_unicode_page = 0; + to_unicode_multiByte = 0; + to_unicode = 0; + from_unicode_page_multiByte = 0; + max_bytes_per_char = 1; + + const int maxlen=100; + char line[maxlen]; + char esc='\\'; + char comm='%'; + bool incmap = FALSE; + while (iod->readLine(line,maxlen) > 0) { + if (0==tqstrnicmp(line,"<code_set_name>",15)) + n = line+15; + else if (0==tqstrnicmp(line,"<escape_char> ",14)) + esc = line[14]; + else if (0==tqstrnicmp(line,"<comment_char> ",15)) + comm = line[15]; + else if (line[0]==comm && 0==tqstrnicmp(line+1," alias ",7)) { + aliases.append(line+8); + } else if (0==tqstrnicmp(line,"CHARMAP",7)) { + if (!from_unicode_page) { + from_unicode_page = new char*[256]; + for (int i=0; i<256; i++) + from_unicode_page[i]=0; + } + if (!to_unicode) { + to_unicode = new ushort[256]; + } + incmap = TRUE; + } else if (0==tqstrnicmp(line,"END CHARMAP",11)) + break; + else if (incmap) { + char* cursor = line; + int byte=-1,unicode=-1; + ushort* mb_unicode=0; + const int maxmb=8; // more -> we'll need to improve datastructures + char mb[maxmb+1]; + int nmb=0; + + while (*cursor) { + if (cursor[0]=='<' && cursor[1]=='U' && + cursor[2]>='0' && cursor[2]<='9' && + cursor[3]>='0' && cursor[3]<='9') { + + unicode = strtol(cursor+2,&cursor,16); + + } else if (*cursor==esc) { + + byte = getByte(cursor); + + if ( *cursor == esc ) { + if ( !to_unicode_multiByte ) { + to_unicode_multiByte = + new TQMultiByteUnicodeTable[256]; + for (int i=0; i<256; i++) { + to_unicode_multiByte[i].unicode = + to_unicode[i]; + to_unicode_multiByte[i].multiByte = 0; + } + delete [] to_unicode; + to_unicode = 0; + } + TQMultiByteUnicodeTable* mbut = + to_unicode_multiByte+byte; + mb[nmb++] = byte; + while ( nmb < maxmb && *cursor == esc ) { + // Always at least once + + mbut->unicode = CHAINED; + byte = getByte(cursor); + mb[nmb++] = byte; + if (!mbut->multiByte) { + mbut->multiByte = + new TQMultiByteUnicodeTable[256]; + } + mbut = mbut->multiByte+byte; + mb_unicode = & mbut->unicode; + } + + if ( nmb > max_bytes_per_char ) + max_bytes_per_char = nmb; + } + } else { + cursor++; + } + } + + if (unicode >= 0 && unicode <= 0xffff) + { + TQChar ch((ushort)unicode); + if (!from_unicode_page[ch.row()]) { + from_unicode_page[ch.row()] = new char[256]; + for (int i=0; i<256; i++) + from_unicode_page[ch.row()][i]=0; + } + if ( mb_unicode ) { + from_unicode_page[ch.row()][ch.cell()] = 0; + if (!from_unicode_page_multiByte) { + from_unicode_page_multiByte = new char**[256]; + for (int i=0; i<256; i++) + from_unicode_page_multiByte[i]=0; + } + if (!from_unicode_page_multiByte[ch.row()]) { + from_unicode_page_multiByte[ch.row()] = new char*[256]; + for (int i=0; i<256; i++) + from_unicode_page_multiByte[ch.row()][i] = 0; + } + mb[nmb++] = 0; + from_unicode_page_multiByte[ch.row()][ch.cell()] + = tqstrdup(mb); + *mb_unicode = unicode; + } else { + from_unicode_page[ch.row()][ch.cell()] = (char)byte; + if ( to_unicode ) + to_unicode[byte] = unicode; + else + to_unicode_multiByte[byte].unicode = unicode; + } + } else { + } + } + } + n = n.stripWhiteSpace(); + + unkn = '?'; // ##### Might be a bad choice. + } + + ~TQTextCodecFromIOD() + { + if ( from_unicode_page ) { + for (int i=0; i<256; i++) + if (from_unicode_page[i]) + delete [] from_unicode_page[i]; + } + if ( from_unicode_page_multiByte ) { + for (int i=0; i<256; i++) + if (from_unicode_page_multiByte[i]) + for (int j=0; j<256; j++) + if (from_unicode_page_multiByte[i][j]) + delete [] from_unicode_page_multiByte[i][j]; + } + if ( to_unicode ) + delete [] to_unicode; + if ( to_unicode_multiByte ) + delete [] to_unicode_multiByte; + } + + bool ok() const + { + return !!from_unicode_page; + } + + TQTextDecoder* makeDecoder() const + { + if ( stateless() ) + return TQTextCodec::makeDecoder(); + else + return new TQTextCodecFromIODDecoder(this); + } + + const char* name() const + { + return n; + } + + int mibEnum() const + { + return 0; // #### Unknown. + } + + int heuristicContentMatch(const char*, int) const + { + return 0; + } + + int heuristicNameMatch(const char* hint) const + { + int bestr = TQTextCodec::heuristicNameMatch(hint); + TQStrListIterator it(aliases); + char* a; + while ((a=it.current())) { + ++it; + int r = simpleHeuristicNameMatch(a,hint); + if (r > bestr) + bestr = r; + } + return bestr; + } + + TQString toUnicode(const char* chars, int len) const + { + const uchar* uchars = (const uchar*)chars; + TQString result; + TQMultiByteUnicodeTable* multiByte=to_unicode_multiByte; + if ( multiByte ) { + while (len--) { + TQMultiByteUnicodeTable& mb = multiByte[*uchars]; + if ( mb.multiByte ) { + // Chained multi-byte + multiByte = mb.multiByte; + } else { + result += TQChar(mb.unicode); + multiByte=to_unicode_multiByte; + } + uchars++; + } + } else { + while (len--) + result += TQChar(to_unicode[*uchars++]); + } + return result; + } + +#if !defined(Q_NO_USING_KEYWORD) + using TQTextCodec::fromUnicode; +#endif + TQCString fromUnicode(const TQString& uc, int& lenInOut) const + { + if (lenInOut > (int)uc.length()) + lenInOut = uc.length(); + int rlen = lenInOut*max_bytes_per_char; + TQCString rstr(rlen+1); + char* cursor = rstr.data(); + char* s=0; + int l = lenInOut; + int lout = 0; + for (int i=0; i<l; i++) { + TQChar ch = uc[i]; + if ( ch == TQChar::null ) { + // special + *cursor++ = 0; + } else if ( from_unicode_page[ch.row()] && + from_unicode_page[ch.row()][ch.cell()] ) + { + *cursor++ = from_unicode_page[ch.row()][ch.cell()]; + lout++; + } else if ( from_unicode_page_multiByte && + from_unicode_page_multiByte[ch.row()] && + (s=from_unicode_page_multiByte[ch.row()][ch.cell()]) ) + { + while (*s) { + *cursor++ = *s++; + lout++; + } + } else { + *cursor++ = unkn; + lout++; + } + } + *cursor = 0; + lenInOut = lout; + return rstr; + } +}; + +TQTextCodecFromIODDecoder::TQTextCodecFromIODDecoder(const TQTextCodecFromIOD* c) : + codec(c) +{ + mb = codec->to_unicode_multiByte; +} + +TQString TQTextCodecFromIODDecoder::toUnicode(const char* chars, int len) +{ + const uchar* uchars = (const uchar*)chars; + TQString result; + while (len--) { + TQMultiByteUnicodeTable& t = mb[*uchars]; + if ( t.multiByte ) { + // Chained multi-byte + mb = t.multiByte; + } else { + if ( t.unicode ) + result += TQChar(t.unicode); + mb=codec->to_unicode_multiByte; + } + uchars++; + } + return result; +} + +#ifndef TQT_NO_CODECS +// Cannot use <pre> or \code +/*! + Reads a POSIX2 charmap definition from \a iod. + The parser recognizes the following lines: + +<font name="sans"> +  <code_set_name> <i>name</i></br> +  <escape_char> <i>character</i></br> +  % alias <i>alias</i></br> +  CHARMAP</br> +  <<i>token</i>> /x<i>hexbyte</i> <U<i>unicode</i>> ...</br> +  <<i>token</i>> /d<i>decbyte</i> <U<i>unicode</i>> ...</br> +  <<i>token</i>> /<i>octbyte</i> <U<i>unicode</i>> ...</br> +  <<i>token</i>> /<i>any</i>/<i>any</i>... <U<i>unicode</i>> ...</br> +  END CHARMAP</br> +</font> + + The resulting TQTextCodec is returned (and also added to the global + list of codecs). The name() of the result is taken from the + code_set_name. + + Note that a codec constructed in this way uses much more memory + and is slower than a hand-written TQTextCodec subclass, since + tables in code are kept in memory shared by all TQt applications. + + \sa loadCharmapFile() +*/ +TQTextCodec* TQTextCodec::loadCharmap(TQIODevice* iod) +{ + TQTextCodecFromIOD* r = new TQTextCodecFromIOD(iod); + if ( !r->ok() ) { + delete r; + r = 0; + } + return r; +} + +/*! + A convenience function for loadCharmap() that loads the charmap + definition from the file \a filename. +*/ +TQTextCodec* TQTextCodec::loadCharmapFile(TQString filename) +{ + TQFile f(filename); + if (f.open(IO_ReadOnly)) { + TQTextCodecFromIOD* r = new TQTextCodecFromIOD(&f); + if ( !r->ok() ) + delete r; + else + return r; + } + return 0; +} + +#endif //TQT_NO_CODECS + +/*! + Returns a string representing the current language and + sublanguage, e.g. "pt" for Portuguese, or "pt_br" for Portuguese/Brazil. +*/ + +const char* TQTextCodec::locale() +{ + return TQLocalePrivate::systemLocaleName(); +} + +#ifndef TQT_NO_CODECS + +class TQSimpleTextCodec: public TQTextCodec +{ +public: + TQSimpleTextCodec( int ); + ~TQSimpleTextCodec(); + + TQString toUnicode(const char* chars, int len) const; +#if !defined(Q_NO_USING_KEYWORD) + using TQTextCodec::fromUnicode; +#endif + TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; + unsigned short characterFromUnicode(const TQString &str, int pos) const; + + const char* name() const; + const char* mimeName() const; + int mibEnum() const; + + int heuristicContentMatch(const char* chars, int len) const; + + int heuristicNameMatch(const char* hint) const; +#if !defined(Q_NO_USING_KEYWORD) + using TQTextCodec::canEncode; +#endif + bool canEncode( TQChar ch ) const; + + void fromUnicode( const TQChar *in, unsigned short *out, int length ) const; + +private: + void buildReverseMap(); + + int forwardIndex; +#ifndef TQ_WS_QWS + TQMemArray<unsigned char> *reverseMap; +#endif +}; + +#ifdef TQ_WS_QWS +static const TQSimpleTextCodec * reverseOwner = 0; +static TQMemArray<unsigned char> * reverseMap = 0; +#endif + +#define LAST_MIB 2004 + +static const struct { + const char *mime; + const char * cs; + int mib; + TQ_UINT16 values[128]; +} unicodevalues[] = { + // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt + { "KOI8-R", "KOI8-R", 2084, + { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, + 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, + 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248, + 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, + 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, + 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, + 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, + 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, + 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, + 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, + 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } }, + // /**/ - The BULLET OPERATOR is confused. Some people think + // it should be 0x2022 (BULLET). + + // from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt + { "KOI8-U", "KOI8-U", 2088, + { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, + 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, + 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, + 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, + 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, + 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E, + 0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9, + 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, + 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, + 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, + 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } }, + + // next bits generated from tables on the Unicode 2.0 CD. we can + // use these tables since this is part of the transition to using + // unicode everywhere in qt. + + // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits ) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done + + // then I inserted the files manually. + { "ISO-8859-2", "ISO 8859-2", 5, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, + 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, + 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, + 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, + 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, + 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, + { "ISO-8859-3", "ISO 8859-3", 6, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFD, 0x0124, 0x00A7, + 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFD, 0x017B, + 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, + 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFD, 0x017C, + 0x00C0, 0x00C1, 0x00C2, 0xFFFD, 0x00C4, 0x010A, 0x0108, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0xFFFD, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, + 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0xFFFD, 0x00E4, 0x010B, 0x0109, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, + 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} }, + { "ISO-8859-4", "ISO 8859-4", 7, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, + 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, + 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, + 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, + 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, + 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, + 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, + 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} }, + { "ISO-8859-5", "ISO 8859-5", 8, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} }, + { "ISO-8859-6", "ISO 8859-6", 82, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x060C, 0x00AD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0x061B, 0xFFFD, 0xFFFD, 0xFFFD, 0x061F, + 0xFFFD, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, + 0x0638, 0x0639, 0x063A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, + 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, + 0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, + { "ISO-8859-7", "ISO 8859-7", 10, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x2018, 0x2019, 0x00A3, 0xFFFD, 0xFFFD, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0xFFFD, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, + 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, + { "ISO-8859-8-I", "ISO 8859-8-I", 85, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2017, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, + 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, + 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, + { "ISO-8859-9", "ISO 8859-9", 12, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, + { "ISO-8859-10", "ISO 8859-10", 13, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, + 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, + 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, + 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, + 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, + 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, + 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} }, + { "ISO-8859-13", "ISO 8859-13", 109, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, + 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, + 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, + 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, + 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, + 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, + 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} }, + { "ISO-8859-14", "ISO 8859-14", 110, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, + 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, + 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, + 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} }, + { "ISO-8859-16", "ISO 8859-16", 112, + { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, + 0x00A0, 0x0104, 0x0105, 0x0141, 0x20AC, 0x201E, 0x0160, 0x00A7, + 0x0161, 0x00A9, 0x0218, 0x00AB, 0x0179, 0x00AD, 0x017A, 0x017B, + 0x00B0, 0x00B1, 0x010C, 0x0142, 0x017D, 0x201D, 0x00B6, 0x00B7, + 0x017E, 0x010D, 0x0219, 0x00BB, 0x0152, 0x0153, 0x0178, 0x017C, + 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0106, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x0110, 0x0143, 0x00D2, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x015A, + 0x0170, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0118, 0x021A, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x0107, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, + 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF} }, + + // next bits generated again from tables on the Unicode 3.0 CD. + + // $ for a in CP* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done + + { "CP 850", "IBM 850", 2009, + { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, + 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, + 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, + 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, + 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, + 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, + 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, + 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, + 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, + 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, + 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, + 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, + 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0} }, + { "CP 874", "CP 874", 0, //### what is the mib? + { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, + 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, + 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, + 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, + 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, + 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, + 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, + 0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F, + 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, + 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, + 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, + 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, + { "IBM 866", "IBM 866", 2086, + { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, + 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, + 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, + 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, + 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} }, + + { "windows-1250", "CP 1250", 2250, + { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, + 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, + 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, + 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, + 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, + 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, + { "windows-1251", "CP 1251", 2251, + { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, + 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, + 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, + 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, + 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, + 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, + 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} }, + { "windows-1252", "CP 1252", 2252, + { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0x017E, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, + { "windows-1253", "CP 1253", 2253, + { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, + 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, + { "windows-1254", "CP 1254", 2254, + { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, + { "windows-1255", "CP 1255", 2255, + { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, + 0x05B8, 0x05B9, 0xFFFD, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, + 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, + 0x05F4, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, + 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, + 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, + 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} }, + { "windows-1256", "CP 1256", 2256, + { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, + 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, + 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, + 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, + 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, + 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, + 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, + 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} }, + { "windows-1257", "CP 1257", 2257, + { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, + 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0x00AF, 0x02DB, 0xFFFD, + 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0xFFFD, 0x00A6, 0x00A7, + 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, + 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, + 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, + 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, + 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, + 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, + 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, + 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, + 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} }, + { "windows-1258", "CP 1258", 2258, + { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0xFFFD, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, + 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, + 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, + 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, + 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, + + { "Apple Roman", "Apple Roman", 0, + { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, + 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, + 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, + 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, + 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, + 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, + 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, + 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, + 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, + 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, + 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, + 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, + 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, + 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, + 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, + 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7} }, + + + + // This one is based on the charmap file + // /usr/share/i18n/charmaps/SAMI-WS2.gz, which is manually adapted + // to this format by Børre Gaup <boerre@subdimension.com> + { "WINSAMI2", "WS2", 0, + { 0x20AC, 0xFFFD, 0x010C, 0x0192, 0x010D, 0x01B7, 0x0292, 0x01EE, + 0x01EF, 0x0110, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x0111, 0x01E6, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, + 0x00A0, 0x01E7, 0x01E4, 0x00A3, 0x00A4, 0x01E5, 0x00A6, 0x00A7, + 0x00A8, 0x00A9, 0x021E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x021F, + 0x00B0, 0x00B1, 0x01E8, 0x01E9, 0x00B4, 0x00B5, 0x00B6, 0x00B7, + 0x014A, 0x014B, 0x0166, 0x00BB, 0x0167, 0x00BD, 0x017D, 0x017E, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, + + + // this one is generated from the charmap file located in /usr/share/i18n/charmaps + // on most Linux distributions. The thai character set tis620 is byte by byte equivalent + // to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too. + + // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; ( cut -c25- < TIS-620 ; cat /tmp/digits ) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's/<U/0x/' -e 's/>//' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620 + { "TIS-620", "ISO 8859-11", 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent) + { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, + 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, + 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, + 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, + 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, + 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, + 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, + 0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F, + 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, + 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, + 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, + 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD } }, + + /* + Name: hp-roman8 [HP-PCL5,RFC1345,KXS2] + MIBenum: 2004 + Source: LaserJet IIP Printer User's Manual, + HP part no 33471-90901, Hewlet-Packard, June 1989. + Alias: roman8 + Alias: r8 + Alias: csHPRoman8 + */ + { "Roman8", "HP-Roman8", 2004, + { 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0x00A0, 0x00C0, 0x00C2, 0x00C8, 0x00CA, 0x00CB, 0x00CE, 0x00CF, + 0x00B4, 0x02CB, 0x02C6, 0x00A8, 0x02DC, 0x00D9, 0x00DB, 0x20A4, + 0x00AF, 0x00DD, 0x00FD, 0x00B0, 0x00C7, 0x00E7, 0x00D1, 0x00F1, + 0x00A1, 0x00BF, 0x00A4, 0x00A3, 0x00A5, 0x00A7, 0x0192, 0x00A2, + 0x00E2, 0x00EA, 0x00F4, 0x00FB, 0x00E1, 0x00E9, 0x00F3, 0x00FA, + 0x00E0, 0x00E8, 0x00F2, 0x00F9, 0x00E4, 0x00EB, 0x00F6, 0x00FC, + 0x00C5, 0x00EE, 0x00D8, 0x00C6, 0x00E5, 0x00ED, 0x00F8, 0x00E6, + 0x00C4, 0x00EC, 0x00D6, 0x00DC, 0x00C9, 0x00EF, 0x00DF, 0x00D4, + 0x00C1, 0x00C3, 0x00E3, 0x00D0, 0x00F0, 0x00CD, 0x00CC, 0x00D3, + 0x00D2, 0x00D5, 0x00F5, 0x0160, 0x0161, 0x00DA, 0x0178, 0x00FF, + 0x00DE, 0x00FE, 0x00B7, 0x00B5, 0x00B6, 0x00BE, 0x2014, 0x00BC, + 0x00BD, 0x00AA, 0x00BA, 0x00AB, 0x25A0, 0x00BB, 0x00B1, 0xFFFD } } + + // if you add more chacater sets at the end, change LAST_MIB above +}; + +TQSimpleTextCodec::TQSimpleTextCodec( int i ) + : TQTextCodec(), forwardIndex( i ) +{ +#ifndef TQ_WS_QWS + reverseMap = 0; +#endif +} + + +TQSimpleTextCodec::~TQSimpleTextCodec() +{ +#ifndef TQ_WS_QWS + delete reverseMap; +#else + if ( reverseOwner == this ) { + delete reverseMap; + reverseMap = 0; + reverseOwner = 0; + } +#endif +} + +void TQSimpleTextCodec::buildReverseMap() +{ +#ifdef TQ_WS_QWS + if ( reverseOwner != this ) { + int m = 0; + int i = 0; + while( i < 128 ) { + if ( unicodevalues[forwardIndex].values[i] > m && + unicodevalues[forwardIndex].values[i] < 0xfffd ) + m = unicodevalues[forwardIndex].values[i]; + i++; + } + m++; + if ( !reverseMap ) + reverseMap = new TQMemArray<unsigned char>( m ); + if ( m > (int)(reverseMap->size()) ) + reverseMap->resize( m ); + for( i = 0; i < 128 && i < m; i++ ) + (*reverseMap)[i] = (char)i; + for( ;i < m; i++ ) + (*reverseMap)[i] = 0; + for( i=128; i<256; i++ ) { + int u = unicodevalues[forwardIndex].values[i-128]; + if ( u < m ) + (*reverseMap)[u] = (char)(unsigned char)(i); + } + reverseOwner = this; + } +#else + if ( !reverseMap ) { + TQMemArray<unsigned char> **map = &((TQSimpleTextCodec *)this)->reverseMap; + int m = 0; + int i = 0; + while( i < 128 ) { + if ( unicodevalues[forwardIndex].values[i] > m && + unicodevalues[forwardIndex].values[i] < 0xfffd ) + m = unicodevalues[forwardIndex].values[i]; + i++; + } + m++; + *map = new TQMemArray<unsigned char>( m ); + for( i = 0; i < 128 && i < m; i++ ) + (**map)[i] = (char)i; + for( ;i < m; i++ ) + (**map)[i] = 0; + for( i=128; i<256; i++ ) { + int u = unicodevalues[forwardIndex].values[i-128]; + if ( u < m ) + (**map)[u] = (char)(unsigned char)(i); + } + } +#endif +} + +TQString TQSimpleTextCodec::toUnicode(const char* chars, int len) const +{ + if ( len <= 0 || chars == 0 ) + return TQString::null; + + const unsigned char * c = (const unsigned char *)chars; + int i; + + for ( i = 0; i < len; i++ ) + if ( c[i] == '\0' ) { + len = i; + break; + } + + TQString r; + r.setUnicode(0, len); + TQChar* uc = (TQChar*)r.unicode(); // const_cast + + for ( i = 0; i < len; i++ ) { + if ( c[i] > 127 ) + uc[i] = unicodevalues[forwardIndex].values[c[i]-128]; + else + uc[i] = c[i]; + } + return r; +} + + +TQCString TQSimpleTextCodec::fromUnicode(const TQString& uc, int& len ) const +{ +#ifdef TQ_WS_QWS + if ( this != reverseOwner ) +#else + if ( !reverseMap ) +#endif + ((TQSimpleTextCodec *)this)->buildReverseMap(); + + if ( len <0 || len > (int)uc.length() ) + len = uc.length(); + TQCString r( len+1 ); + int i = len; + int u; + const TQChar* ucp = uc.unicode(); + unsigned char* rp = (unsigned char *)r.data(); + unsigned char* rmp = reverseMap->data(); + int rmsize = (int) reverseMap->size(); + while( i-- ) + { + u = ucp->unicode(); + *rp = u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : '?' ); + if ( *rp == 0 ) *rp = '?'; + rp++; + ucp++; + } + r[len] = 0; + return r; +} + +void TQSimpleTextCodec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const +{ +#ifdef TQ_WS_QWS + if ( this != reverseOwner ) +#else + if ( !reverseMap ) +#endif + ((TQSimpleTextCodec *)this)->buildReverseMap(); + + unsigned char* rmp = reverseMap->data(); + int rmsize = (int) reverseMap->size(); + while ( length-- ) { + unsigned short u = in->unicode(); + *out = u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : 0 ); + ++in; + ++out; + } +} + +unsigned short TQSimpleTextCodec::characterFromUnicode(const TQString &str, int pos) const +{ +#ifdef TQ_WS_QWS + if ( this != reverseOwner ) +#else + if ( !reverseMap ) +#endif + ((TQSimpleTextCodec *)this)->buildReverseMap(); + + unsigned short u = str[pos].unicode(); + unsigned char* rmp = reverseMap->data(); + int rmsize = (int) reverseMap->size(); + return u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : 0 ); +} + +bool TQSimpleTextCodec::canEncode( TQChar ch ) const +{ +#ifdef TQ_WS_QWS + if ( this != reverseOwner ) +#else + if ( !reverseMap ) +#endif + ((TQSimpleTextCodec *)this)->buildReverseMap(); + + unsigned short u = ch.unicode(); + unsigned char* rmp = reverseMap->data(); + int rmsize = (int) reverseMap->size(); + return u < 128 ? TRUE : (( u < rmsize ) ? (*(rmp+u) != 0) : FALSE ); +} + +const char* TQSimpleTextCodec::name() const +{ + return unicodevalues[forwardIndex].cs; +} + +const char* TQSimpleTextCodec::mimeName() const +{ + return unicodevalues[forwardIndex].mime; +} + + +int TQSimpleTextCodec::mibEnum() const +{ + return unicodevalues[forwardIndex].mib; +} + +int TQSimpleTextCodec::heuristicNameMatch(const char* hint) const +{ + if ( tqstricmp( hint, mimeName() ) == 0 ) + return 10000; // return a large value + if ( hint[0]=='k' ) { + TQCString lhint = TQCString(hint).lower(); + // Help people with messy fonts + if ( lhint == "koi8-1" ) + return TQTextCodec::heuristicNameMatch("koi8-r")-1; + if ( lhint == "koi8-ru" ) + return TQTextCodec::heuristicNameMatch("koi8-r")-1; + } else if ( hint[0] == 't' && mibEnum() == 2259 /* iso8859-11 */ ) { + // 8859-11 and tis620 are byte by byte equivalent + int i = simpleHeuristicNameMatch("tis620-0", hint); + if( !i ) + i = simpleHeuristicNameMatch("tis-620", hint); + if( i ) return i; + } else if ( mibEnum() == 82 /* ISO 8859-6 */ ) { + int i = simpleHeuristicNameMatch("ISO 8859-6-I", hint); + if ( i ) + return i; + } + return TQTextCodec::heuristicNameMatch(hint); +} + +int TQSimpleTextCodec::heuristicContentMatch(const char* chars, int len) const +{ + if ( len<1 || !chars ) + return -1; + int i = 0; + const uchar * c = (const unsigned char *)chars; + int r = 0; + while( i<len && c && *c ) { + if ( *c >= 128 ) { + if ( unicodevalues[forwardIndex].values[(*c)-128] == 0xfffd ) + return -1; + } + if ( (*c >= ' ' && *c < 127) || + *c == '\n' || *c == '\t' || *c == '\r' ) + r++; + i++; + c++; + } + if ( mibEnum()==4 ) + r+=1; + return r; +} + +#endif + +class TQLatin1Codec : public TQTextCodec +{ +public: +#if !defined(Q_NO_USING_KEYWORD) + using TQTextCodec::fromUnicode; + using TQTextCodec::toUnicode; +#endif + TQString toUnicode(const char* chars, int len) const; + TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; + void fromUnicode( const TQChar *in, unsigned short *out, int length ) const; + unsigned short characterFromUnicode(const TQString &str, int pos) const; + + const char* name() const; + const char* mimeName() const; + int mibEnum() const; + + int heuristicContentMatch(const char* chars, int len) const; + +private: + int forwardIndex; +}; + + +TQString TQLatin1Codec::toUnicode(const char* chars, int len) const +{ + if ( chars == 0 ) + return TQString::null; + + return TQString::fromLatin1(chars, len); +} + + +TQCString TQLatin1Codec::fromUnicode(const TQString& uc, int& len ) const +{ + if ( len <0 || len > (int)uc.length() ) + len = uc.length(); + TQCString r( len+1 ); + char *d = r.data(); + int i = 0; + const TQChar *ch = uc.unicode(); + while ( i < len ) { + d[i] = ch->row() ? '?' : ch->cell(); + i++; + ch++; + } + r[len] = 0; + return r; +} + +void TQLatin1Codec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const +{ + while ( length-- ) { + *out = in->row() ? 0 : in->cell(); + ++in; + ++out; + } +} + +unsigned short TQLatin1Codec::characterFromUnicode(const TQString &str, int pos) const +{ + const TQChar *ch = str.unicode() + pos; + if (ch->row()) + return 0; + return (unsigned short) ch->cell(); +} + + +const char* TQLatin1Codec::name() const +{ + return "ISO 8859-1"; +} + +const char* TQLatin1Codec::mimeName() const +{ + return "ISO-8859-1"; +} + + +int TQLatin1Codec::mibEnum() const +{ + return 4; +} + +int TQLatin1Codec::heuristicContentMatch(const char* chars, int len) const +{ + if ( len<1 || !chars ) + return -1; + int i = 0; + const uchar * c = (const unsigned char *)chars; + int r = 0; + while( i<len && c && *c ) { + if ( *c >= 0x80 && *c < 0xa0 ) + return -1; + if ( (*c >= ' ' && *c < 127) || + *c == '\n' || *c == '\t' || *c == '\r' ) + r++; + i++; + c++; + } + if ( this == (const TQTextCodec *)codecForLocale() ) + r += 5; + return r; +} + +class TQLatin15Codec: public TQLatin1Codec +{ +public: + TQString toUnicode(const char* chars, int len) const; +#if !defined(Q_NO_USING_KEYWORD) + using TQLatin1Codec::fromUnicode; +#endif + TQCString fromUnicode(const TQString& uc, int& lenInOut ) const; + void fromUnicode( const TQChar *in, unsigned short *out, int length ) const; + unsigned short characterFromUnicode(const TQString &str, int pos) const; + + const char* name() const; + const char* mimeName() const; + int mibEnum() const; + +private: + int forwardIndex; +}; + + +TQString TQLatin15Codec::toUnicode(const char* chars, int len) const +{ + if ( chars == 0 ) + return TQString::null; + + TQString str = TQString::fromLatin1(chars, len); + TQChar *uc = (TQChar *)str.unicode(); + while( len-- ) { + switch( uc->unicode() ) { + case 0xa4: + *uc = 0x20ac; + break; + case 0xa6: + *uc = 0x0160; + break; + case 0xa8: + *uc = 0x0161; + break; + case 0xb4: + *uc = 0x017d; + break; + case 0xb8: + *uc = 0x017e; + break; + case 0xbc: + *uc = 0x0152; + break; + case 0xbd: + *uc = 0x0153; + break; + case 0xbe: + *uc = 0x0178; + break; + default: + break; + } + uc++; + } + return str; +} + +static inline unsigned char +latin15CharFromUnicode( unsigned short uc, bool replacement = TRUE ) +{ + uchar c; + if ( uc < 0x0100 ) { + if ( uc > 0xa3 && uc < 0xbf ) { + switch( uc ) { + case 0xa4: + case 0xa6: + case 0xa8: + case 0xb4: + case 0xb8: + case 0xbc: + case 0xbd: + case 0xbe: + c = replacement ? '?' : 0; + break; + default: + c = (unsigned char) uc; + break; + } + } else { + c = (unsigned char) uc; + } + } else { + if ( uc == 0x20ac ) + c = 0xa4; + else if ( (uc & 0xff00) == 0x0100 ) { + switch( uc ) { + case 0x0160: + c = 0xa6; + break; + case 0x0161: + c = 0xa8; + break; + case 0x017d: + c = 0xb4; + break; + case 0x017e: + c = 0xb8; + break; + case 0x0152: + c = 0xbc; + break; + case 0x0153: + c = 0xbd; + break; + case 0x0178: + c = 0xbe; + break; + default: + c = replacement ? '?' : 0; + } + } else { + c = replacement ? '?' : 0; + } + } + return c; +} + + +void TQLatin15Codec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const +{ + while ( length-- ) { + *out = latin15CharFromUnicode( in->unicode(), FALSE ); + ++in; + ++out; + } +} + + +TQCString TQLatin15Codec::fromUnicode(const TQString& uc, int& len ) const +{ + if ( len <0 || len > (int)uc.length() ) + len = uc.length(); + TQCString r( len+1 ); + char *d = r.data(); + int i = 0; + const TQChar *ch = uc.unicode(); + while ( i < len ) { + d[i] = latin15CharFromUnicode( ch->unicode() ); + i++; + ch++; + } + r[len] = 0; + return r; +} + +unsigned short TQLatin15Codec::characterFromUnicode(const TQString &str, int pos) const +{ + return latin15CharFromUnicode( str.unicode()[pos].unicode(), FALSE ); +} + + +const char* TQLatin15Codec::name() const +{ + return "ISO 8859-15"; +} + +const char* TQLatin15Codec::mimeName() const +{ + return "ISO-8859-15"; +} + + +int TQLatin15Codec::mibEnum() const +{ + return 111; +} + +static TQTextCodec *checkForCodec(const char *name) { + TQTextCodec *c = TQTextCodec::codecForName(name); + if (!c) { + const char *at = strchr(name, '@'); + if (at) { + TQCString n(name, at - name + 1); + c = TQTextCodec::codecForName(n.data()); + } + } + return c; +} + +/* the next function is implicitely thread safe, + as they are only called by setup() which uses a mutex. +*/ +static void setupLocaleMapper() +{ +#ifdef Q_OS_WIN32 + localeMapper = TQTextCodec::codecForName( "System" ); +#else + +#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX6) && !defined(Q_OS_OSF) && !defined(Q_OS_MAC) + char *charset = nl_langinfo (CODESET); + if ( charset ) + localeMapper = TQTextCodec::codecForName( charset ); +#endif + + if ( !localeMapper ) { + // Very poorly defined and followed standards causes lots of code + // to try to get all the cases... + + // Try to determine locale codeset from locale name assigned to + // LC_CTYPE category. + + // First part is getting that locale name. First try setlocale() which + // definitely knows it, but since we cannot fully trust it, get ready + // to fall back to environment variables. + char * ctype = tqstrdup( setlocale( LC_CTYPE, 0 ) ); + + // Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG + // environment variables. + char * lang = tqstrdup( getenv("LC_ALL") ); + if ( !lang || lang[0] == 0 || strcmp( lang, "C" ) == 0 ) { + if ( lang ) delete [] lang; + lang = tqstrdup( getenv("LC_CTYPE") ); + } + if ( !lang || lang[0] == 0 || strcmp( lang, "C" ) == 0 ) { + if ( lang ) delete [] lang; + lang = tqstrdup( getenv("LANG") ); + } + + // Now try these in order: + // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15) + // 2. CODESET from lang if it contains a .CODESET part + // 3. ctype (maybe the locale is named "ISO-8859-1" or something) + // 4. locale (ditto) + // 5. check for "@euro" + // 6. guess locale from ctype unless ctype is "C" + // 7. guess locale from lang + + // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15) + char * codeset = ctype ? strchr( ctype, '.' ) : 0; + if ( codeset && *codeset == '.' ) + localeMapper = checkForCodec( codeset + 1 ); + + // 2. CODESET from lang if it contains a .CODESET part + codeset = lang ? strchr( lang, '.' ) : 0; + if ( !localeMapper && codeset && *codeset == '.' ) + localeMapper = checkForCodec( codeset + 1 ); + + // 3. ctype (maybe the locale is named "ISO-8859-1" or something) + if ( !localeMapper && ctype && *ctype != 0 && strcmp (ctype, "C") != 0 ) + localeMapper = checkForCodec( ctype ); + + // 4. locale (ditto) + if ( !localeMapper && lang && *lang != 0 ) + localeMapper = checkForCodec( lang ); + + // 5. "@euro" + if ( ( !localeMapper && ctype && strstr( ctype, "@euro" ) ) || (lang && strstr( lang, "@euro" ) ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-15" ); + + // 6. guess locale from ctype unless ctype is "C" + // 7. guess locale from lang + char * try_by_name = ctype; + if ( ctype && *ctype != 0 && strcmp (ctype, "C") != 0 ) + try_by_name = lang; + + // Now do the guessing. + if ( lang && *lang && !localeMapper && try_by_name && *try_by_name ) { + if ( try_locale_list( iso8859_15locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-15" ); + else if ( try_locale_list( iso8859_2locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-2" ); + else if ( try_locale_list( iso8859_3locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-3" ); + else if ( try_locale_list( iso8859_4locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-4" ); + else if ( try_locale_list( iso8859_5locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-5" ); + else if ( try_locale_list( iso8859_6locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-6" ); + else if ( try_locale_list( iso8859_7locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-7" ); + else if ( try_locale_list( iso8859_8locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-8-I" ); + else if ( try_locale_list( iso8859_9locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-9" ); + else if ( try_locale_list( iso8859_13locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-13" ); + else if ( try_locale_list( tis_620locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-11" ); + else if ( try_locale_list( koi8_ulocales, lang ) ) + localeMapper = TQTextCodec::codecForName( "KOI8-U" ); + else if ( try_locale_list( cp_1251locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "CP 1251" ); + else if ( try_locale_list( pt_154locales, lang ) ) + localeMapper = TQTextCodec::codecForName( "PT 154" ); + else if ( try_locale_list( probably_koi8_rlocales, lang ) ) + localeMapper = ru_RU_hack( lang ); + } + + delete [] ctype; + delete [] lang; + } + if ( localeMapper && localeMapper->mibEnum() == 11 ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-8-I" ); + + // If everything failed, we default to 8859-1 + // We could perhaps default to 8859-15. + if ( !localeMapper ) + localeMapper = TQTextCodec::codecForName( "ISO 8859-1" ); +#endif +} + + +static void setup() +{ +#if defined(QT_CHECK_STATE) + if ( codecs_destroyed ) + { + // If codecs have been destroyed, the application is being destroyed. + // Do not create new codecs since this could lead to SEGV while trying to + // print a message using tqWarning/tqDebug/tqFatal at this stage + // + // Note: the use of `printf` instead of `tqWarning` is intentional. We should never + // get to this line of code. If we do, we are in some strange exception that we + // didn't think of. Using `tqWarning` could potentially lead to an infinite loop with + // `tqWarning` trying to setup codecs and this method calling `tqWarning` again. + // Using `printf` makes sure this never happens, even for exceptions we didn't foresee. + printf("TQTextCodec: setup() called when codecs have already been destroyed\n"); fflush(stdout); + return; + } +#endif + + if ( all ) return; + +#ifdef TQT_THREAD_SUPPORT + TQMutexLocker locker( tqt_global_mutexpool ? + tqt_global_mutexpool->get( &all ) : 0 ); +#endif // TQT_THREAD_SUPPORT + + all = new TQValueList<TQTextCodec*>; + + (void)new TQLatin1Codec; + (void)new TQLatin15Codec; + (void)new TQUtf8Codec; + (void)new TQUtf16Codec; + +#ifndef TQT_NO_CODECS + int i = 0; + do { + (void)new TQSimpleTextCodec( i ); + } while( unicodevalues[i++].mib != LAST_MIB ); + + (void)new TQTsciiCodec; + + for (i = 0; i < 9; ++i) { + (void)new TQIsciiCodec(i); + } +#endif // TQT_NO_CODECS +#ifndef TQT_NO_CODEC_HEBREW + (void)new TQHebrewCodec; +#endif +#ifndef TQT_NO_BIG_CODECS + (void)new TQBig5Codec; + (void)new TQBig5hkscsCodec; + (void)new TQEucJpCodec; + (void)new TQEucKrCodec; + (void)new TQGb2312Codec; + (void)new TQGbkCodec; + (void)new TQGb18030Codec; + (void)new TQJisCodec; + (void)new TQSjisCodec; +#endif // TQT_NO_BIG_CODECS + +#ifdef Q_OS_WIN32 + (void) new TQWindowsLocalCodec; +#endif // Q_OS_WIN32 + + if ( !localeMapper ) + setupLocaleMapper(); +} + +void TQTextCodec::fromUnicodeInternal( const TQChar *in, unsigned short *out, int length ) +{ + switch( mibEnum() ) { +#ifndef TQT_NO_CODECS + case 2084: + case 2088: + case 5: + case 6: + case 7: + case 8: + case 82: + case 10: + case 85: + case 12: + case 13: + case 109: + case 110: + case 2004: + case 2009: + case 2086: + case 2250: + case 2251: + case 2252: + case 2253: + case 2254: + case 2255: + case 2256: + case 2257: + case 2258: + case 2259: + ((TQSimpleTextCodec *)this)->fromUnicode( in, out, length ); + break; + +#if !defined(TQT_NO_BIG_CODECS) && defined(TQ_WS_X11) + // the TQFont*Codecs are only used on X11 + + case 15: + ((TQFontJis0201Codec *) this)->fromUnicode( in, out, length ); + break; + + case 63: + ((TQFontJis0208Codec *) this)->fromUnicode( in, out, length ); + break; + + case 36: + ((TQFontKsc5601Codec *) this)->fromUnicode( in, out, length ); + break; + + case 57: + ((TQFontGb2312Codec *) this)->fromUnicode( in, out, length ); + break; + + case -113: + ((TQFontGbkCodec *) this)->fromUnicode( in, out, length ); + break; + + case -114: + ((TQFontGb18030_0Codec *) this)->fromUnicode( in, out, length ); + break; + + case -2026: + ((TQFontBig5Codec *) this)->fromUnicode( in, out, length ); + break; + + case -2101: + ((TQFontBig5hkscsCodec *) this)->fromUnicode( in, out, length ); + break; + + case -4242: + ((TQFontLaoCodec *) this)->fromUnicode( in, out, length ); + break; +#endif +#endif // TQT_NO_CODECS + + case 4: + ((TQLatin1Codec *) this)->fromUnicode( in, out, length ); + break; + + case 111: + ((TQLatin15Codec *) this)->fromUnicode( in, out, length ); + break; + + default: + { + TQConstString string( in, length ); + TQString str = string.string(); + for ( int i = 0; i < length; i++ ) + out[i] = characterFromUnicode( str, i ); + } + } +} + + +/*! + \fn TQTextCodec* TQTextCodec::codecForTr() + + Returns the codec used by TQObject::tr() on its argument. If this + function returns 0 (the default), tr() assumes Latin-1. + + \sa setCodecForTr() +*/ + +/*! + \fn void TQTextCodec::setCodecForTr(TQTextCodec *c) + \nonreentrant + + Sets the codec used by TQObject::tr() on its argument to \a c. If + \a c is 0 (the default), tr() assumes Latin-1. + + If the literal quoted text in the program is not in the Latin-1 + encoding, this function can be used to set the appropriate + encoding. For example, software developed by Korean programmers + might use eucKR for all the text in the program, in which case the + main() function might look like this: + + \code + int main(int argc, char** argv) + { + TQApplication app(argc, argv); + ... install any additional codecs ... + TQTextCodec::setCodecForTr( TQTextCodec::codecForName("eucKR") ); + ... + } + \endcode + + Note that this is not the way to select the encoding that the \e + user has chosen. For example, to convert an application containing + literal English strings to Korean, all that is needed is for the + English strings to be passed through tr() and for translation + files to be loaded. For details of internationalization, see the + \link i18n.html TQt internationalization documentation\endlink. + + \sa codecForTr(), setCodecForTr(), setCodecForCStrings() +*/ + + +/*! + \fn TQTextCodec* TQTextCodec::codecForCStrings() + + Returns the codec used by TQString to convert to and from const + char* and TQCStrings. If this function returns 0 (the default), + TQString assumes Latin-1. + + \sa setCodecForCStrings() +*/ + +/*! + \fn void TQTextCodec::setCodecForCStrings(TQTextCodec *c) + \nonreentrant + + Sets the codec used by TQString to convert to and from const char* + and TQCStrings. If \a c is 0 (the default), TQString assumes Latin-1. + + \warning Some codecs do not preserve the characters in the ascii + range (0x00 to 0x7f). For example, the Japanese Shift-JIS + encoding maps the backslash character (0x5a) to the Yen character. + This leads to unexpected results when using the backslash + character to escape characters in strings used in e.g. regular + expressions. Use TQString::fromLatin1() to preserve characters in + the ascii range when needed. + + \sa codecForCStrings(), setCodecForTr(), setCodecForCStrings() +*/ + + +TQTextCodec *TQTextCodec::cftr = 0; +TQTextCodec *TQTextCodec::cfcs = 0; + + +#endif // TQT_NO_TEXTCODEC diff --git a/src/codecs/tqtextcodec.h b/src/codecs/tqtextcodec.h new file mode 100644 index 00000000..f5554d26 --- /dev/null +++ b/src/codecs/tqtextcodec.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Definition of TQTextCodec class +** +** Created : 981015 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTCODEC_H +#define TQTEXTCODEC_H + +#ifndef QT_H +#include "tqstring.h" +#endif // QT_H + +#ifndef TQT_NO_TEXTCODEC + +class TQTextCodec; +class TQIODevice; +class TQFont; + +class TQ_EXPORT TQTextEncoder { +public: + virtual ~TQTextEncoder(); + virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) = 0; +}; + +class TQ_EXPORT TQTextDecoder { +public: + virtual ~TQTextDecoder(); + virtual TQString toUnicode(const char* chars, int len) = 0; +}; + +class TQ_EXPORT TQTextCodec { +public: + virtual ~TQTextCodec(); + +#ifndef TQT_NO_CODECS + static TQTextCodec* loadCharmap(TQIODevice*); + static TQTextCodec* loadCharmapFile(TQString filename); +#endif //TQT_NO_CODECS + static TQTextCodec* codecForMib(int mib); + static TQTextCodec* codecForName(const char* hint, int accuracy=0); + static TQTextCodec* codecForContent(const char* chars, int len); + static TQTextCodec* codecForIndex(int i); + static TQTextCodec* codecForLocale(); + static void setCodecForLocale(TQTextCodec *c); + + static TQTextCodec* codecForTr(); + static void setCodecForTr(TQTextCodec *c); + static TQTextCodec* codecForCStrings(); + static void setCodecForCStrings(TQTextCodec *c); + + static void deleteAllCodecs(); + + static const char* locale(); + + virtual const char* name() const = 0; + virtual const char* mimeName() const; + virtual int mibEnum() const = 0; + + virtual TQTextDecoder* makeDecoder() const; + virtual TQTextEncoder* makeEncoder() const; + + virtual TQString toUnicode(const char* chars, int len) const; + virtual TQCString fromUnicode(const TQString& uc, int& lenInOut) const; + + TQCString fromUnicode(const TQString& uc) const; + TQString toUnicode(const TQByteArray&, int len) const; + TQString toUnicode(const TQByteArray&) const; + TQString toUnicode(const TQCString&, int len) const; + TQString toUnicode(const TQCString&) const; + TQString toUnicode(const char* chars) const; + virtual bool canEncode( TQChar ) const; + virtual bool canEncode( const TQString& ) const; + + virtual int heuristicContentMatch(const char* chars, int len) const = 0; + virtual int heuristicNameMatch(const char* hint) const; + + virtual TQByteArray fromUnicode(const TQString& uc, int from, int len) const; + virtual unsigned short characterFromUnicode(const TQString &str, int pos) const; + +protected: + TQTextCodec(); + static int simpleHeuristicNameMatch(const char* name, const char* hint); + +private: + friend class TQFont; + friend class TQFontEngineXLFD; + void fromUnicodeInternal( const TQChar *in, unsigned short *out, int length ); + + static TQTextCodec *cftr; + static TQTextCodec *cfcs; +}; + +inline TQTextCodec* TQTextCodec::codecForTr() { return cftr; } +inline void TQTextCodec::setCodecForTr(TQTextCodec *c) { cftr = c; } +inline TQTextCodec* TQTextCodec::codecForCStrings() { return cfcs; } +inline void TQTextCodec::setCodecForCStrings(TQTextCodec *c) { cfcs = c; } + +#endif // TQT_NO_TEXTCODEC +#endif // TQTEXTCODEC_H diff --git a/src/codecs/tqtextcodecfactory.cpp b/src/codecs/tqtextcodecfactory.cpp new file mode 100644 index 00000000..24ac82a0 --- /dev/null +++ b/src/codecs/tqtextcodecfactory.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Implementation of TQTextCodecFactory class +** +** Created : 010130 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextcodecfactory.h" + +#ifndef TQT_NO_TEXTCODEC + +#ifndef TQT_NO_COMPONENT +#include "ntqapplication.h" +#include "ntqcleanuphandler.h" +#include <private/qpluginmanager_p.h> +#include "tqtextcodecinterface_p.h" + +#ifdef TQT_THREAD_SUPPORT +# include <private/qmutexpool_p.h> +#endif // TQT_THREAD_SUPPORT + +#include <stdlib.h> + + +static TQPluginManager<TQTextCodecFactoryInterface> *manager = 0; +static TQSingleCleanupHandler< TQPluginManager<TQTextCodecFactoryInterface> > cleanup_manager; + +static void create_manager() +{ + if ( manager ) // already created + return; + +#ifdef TQT_THREAD_SUPPORT + // protect manager creation + TQMutexLocker locker( tqt_global_mutexpool ? + tqt_global_mutexpool->get( &manager ) : 0); + + // we check the manager pointer again to make sure that another thread + // has not created the manager before us. + + if ( manager ) // already created + return; +#endif + + manager = + new TQPluginManager<TQTextCodecFactoryInterface>(IID_QTextCodecFactory, + TQApplication::libraryPaths(), "/codecs", + FALSE); + TQ_CHECK_PTR( manager ); + cleanup_manager.set( &manager ); +} + +#endif // TQT_NO_COMPONENT + + +TQTextCodec *TQTextCodecFactory::createForName(const TQString &name) +{ + TQTextCodec *codec = 0; + +#ifndef TQT_NO_COMPONENT + + // make sure the manager is created + create_manager(); + + TQInterfacePtr<TQTextCodecFactoryInterface> iface; + manager->queryInterface(name, &iface ); + + if (iface) + codec = iface->createForName(name); + +#endif // TQT_NO_COMPONENT + + return codec; +} + + +TQTextCodec *TQTextCodecFactory::createForMib(int mib) +{ + TQTextCodec *codec = 0; + +#ifndef TQT_NO_COMPONENT + + // make sure the manager is created + create_manager(); + + TQInterfacePtr<TQTextCodecFactoryInterface> iface; + manager->queryInterface("MIB-" + TQString::number(mib), &iface ); + + if (iface) + codec = iface->createForMib(mib); + +#endif // TQT_NO_COMPONENT + + return codec; +} + + +#endif // TQT_NO_TEXTCODEC diff --git a/src/codecs/tqtextcodecfactory.h b/src/codecs/tqtextcodecfactory.h new file mode 100644 index 00000000..74cca82c --- /dev/null +++ b/src/codecs/tqtextcodecfactory.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Definition of TQTextCodecFactory class +** +** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTCODECFACTORY_H +#define TQTEXTCODECFACTORY_H + +#ifndef QT_H +#include "tqstringlist.h" +#endif // QT_H + +#ifndef TQT_NO_TEXTCODEC + +class TQTextCodec; + +class TQ_EXPORT TQTextCodecFactory +{ +public: + static TQTextCodec *createForName( const TQString & ); + static TQTextCodec *createForMib( int ); +}; + +#endif // TQT_NO_TEXTCODEC + +#endif // TQTEXTCODECFACTORY_H diff --git a/src/codecs/tqtextcodecinterface_p.h b/src/codecs/tqtextcodecinterface_p.h new file mode 100644 index 00000000..5a8baa04 --- /dev/null +++ b/src/codecs/tqtextcodecinterface_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Definition of TQTextCodecFactoryInterface interface +** +** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTCODECINTERFACE_P_H +#define TQTEXTCODECINTERFACE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the TQt API. It exists for the convenience +// of qpsprinter.cpp and qprinter_x11.cpp. +// This header file may change from version to version without notice, +// or even be removed. +// +// We mean it. +// +// + +#ifndef QT_H +#include <private/qcom_p.h> +#endif // QT_H + +#ifndef TQT_NO_TEXTCODEC +#ifndef TQT_NO_COMPONENT + +class TQTextCodec; + + +// {F55BFA60-F695-11D4-823E-009027DC0F37} +#ifndef IID_QTextCodecFactory +#define IID_QTextCodecFactory TQUuid( 0xf55bfa60, 0xf695, 0x11d4, 0x82, 0x3e, 0x00, 0x90, 0x27, 0xdc, 0x0f, 0x37) +#endif + + +struct TQ_EXPORT TQTextCodecFactoryInterface : public TQFeatureListInterface +{ + virtual TQTextCodec *createForMib( int mib ) = 0; + virtual TQTextCodec *createForName( const TQString &name ) = 0; +}; + +#endif // TQT_NO_COMPONENT +#endif // TQT_NO_TEXTCODEC + +#endif // TQTEXTCODECINTERFACE_P_H diff --git a/src/codecs/tqtextcodecplugin.cpp b/src/codecs/tqtextcodecplugin.cpp new file mode 100644 index 00000000..046b009f --- /dev/null +++ b/src/codecs/tqtextcodecplugin.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Implementation of TQTextCodecPlugin class +** +** Created : 010920 +** +** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextcodecplugin.h" +#ifndef TQT_NO_TEXTCODECPLUGIN +#include "tqtextcodecinterface_p.h" + +/*! + \class TQTextCodecPlugin tqtextcodecplugin.h + \brief The TQTextCodecPlugin class provides an abstract base for custom TQTextCodec plugins. + \reentrant + \ingroup plugins + + The text codec plugin is a simple plugin interface that makes it + easy to create custom text codecs that can be loaded dynamically + into applications. + + Writing a text codec plugin is achieved by subclassing this base + class, reimplementing the pure virtual functions names(), + createForName(), mibEnums() and createForMib(), and exporting the + class with the \c TQ_EXPORT_PLUGIN macro. See the \link + plugins-howto.html TQt Plugins documentation \endlink for details. + + See the \link http://www.iana.org/assignments/character-sets IANA + character-sets encoding file\endlink for more information on mime + names and mib enums. +*/ + +/*! + \fn TQStringList TQTextCodecPlugin::names() const + + Returns the list of mime names supported by this plugin. + + \sa createForName() +*/ + +/*! + \fn TQTextCodec *TQTextCodecPlugin::createForName( const TQString &name ); + + Creates a TQTextCodec object for the codec called \a name. + + \sa names() +*/ + + +/*! + \fn TQValueList<int> TQTextCodecPlugin::mibEnums() const + + Returns the list of mib enums supported by this plugin. + + \sa createForMib() +*/ + +/*! + \fn TQTextCodec *TQTextCodecPlugin::createForMib( int mib ); + + Creates a TQTextCodec object for the mib enum \a mib. + + (See \link + ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets the + IANA character-sets encoding file\endlink for more information) + + \sa mibEnums() +*/ + + + +class TQTextCodecPluginPrivate : public TQTextCodecFactoryInterface +{ +public: + TQTextCodecPluginPrivate( TQTextCodecPlugin *p ) + : plugin( p ) + { + } + virtual ~TQTextCodecPluginPrivate(); + + TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface ); + TQ_REFCOUNT; + + TQStringList featureList() const; + TQTextCodec *createForMib( int mib ); + TQTextCodec *createForName( const TQString &name ); + +private: + TQTextCodecPlugin *plugin; +}; + +TQTextCodecPluginPrivate::~TQTextCodecPluginPrivate() +{ + delete plugin; +} + +TQRESULT TQTextCodecPluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) +{ + *iface = 0; + + if ( iid == IID_QUnknown ) + *iface = this; + else if ( iid == IID_QFeatureList ) + *iface = this; + else if ( iid == IID_QTextCodecFactory ) + *iface = this; + else + return TQE_NOINTERFACE; + + (*iface)->addRef(); + return TQS_OK; +} + +TQStringList TQTextCodecPluginPrivate::featureList() const +{ + TQStringList keys = plugin->names(); + TQValueList<int> mibs = plugin->mibEnums(); + for ( TQValueList<int>::Iterator it = mibs.begin(); it != mibs.end(); ++it ) + keys += TQString("MIB-%1").arg( *it ); + return keys; +} + +TQTextCodec *TQTextCodecPluginPrivate::createForMib( int mib ) +{ + return plugin->createForMib( mib ); +} + +TQTextCodec *TQTextCodecPluginPrivate::createForName( const TQString &name ) +{ + return plugin->createForName( name ); +} + + +/*! + Constructs a text codec plugin. This is invoked automatically by + the \c TQ_EXPORT_PLUGIN macro. +*/ +TQTextCodecPlugin::TQTextCodecPlugin() + : TQGPlugin( d = new TQTextCodecPluginPrivate( this ) ) +{ +} + +/*! + Destroys the text codec plugin. + + You never have to call this explicitly. TQt destroys a plugin + automatically when it is no longer used. +*/ +TQTextCodecPlugin::~TQTextCodecPlugin() +{ +} + +#endif // TQT_NO_TEXTCODECPLUGIN diff --git a/src/codecs/tqtextcodecplugin.h b/src/codecs/tqtextcodecplugin.h new file mode 100644 index 00000000..13a83733 --- /dev/null +++ b/src/codecs/tqtextcodecplugin.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Definition of TQTextCodecPlugin class +** +** Created : 010920 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTCODECPLUGIN_H +#define TQTEXTCODECPLUGIN_H + +#ifndef QT_H +#include "ntqgplugin.h" +#include "tqstringlist.h" +#endif // QT_H + +#ifndef TQT_NO_TEXTCODECPLUGIN +class TQTextCodec; +class TQTextCodecPluginPrivate; + +class TQ_EXPORT TQTextCodecPlugin : public TQGPlugin +{ + TQ_OBJECT +public: + TQTextCodecPlugin(); + ~TQTextCodecPlugin(); + + virtual TQStringList names() const = 0; + virtual TQTextCodec *createForName( const TQString &name ) = 0; + + virtual TQValueList<int> mibEnums() const = 0; + virtual TQTextCodec *createForMib( int mib ) = 0; + +private: + TQTextCodecPluginPrivate *d; +}; +#endif // TQT_NO_TEXTCODECPLUGIN +#endif // TQTEXTCODECPLUGIN_H diff --git a/src/dialogs/qerrormessage.cpp b/src/dialogs/qerrormessage.cpp index 9d27e023..e2b302e5 100644 --- a/src/dialogs/qerrormessage.cpp +++ b/src/dialogs/qerrormessage.cpp @@ -51,7 +51,7 @@ #include "ntqpushbutton.h" #include "tqstringlist.h" #include "ntqstylesheet.h" -#include "ntqtextview.h" +#include "tqtextview.h" #include <stdio.h> #include <stdlib.h> diff --git a/src/dialogs/qprintdialog.cpp b/src/dialogs/qprintdialog.cpp index 0e37e861..2402de7d 100644 --- a/src/dialogs/qprintdialog.cpp +++ b/src/dialogs/qprintdialog.cpp @@ -44,7 +44,7 @@ #include "ntqfiledialog.h" #include "ntqfile.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqcombobox.h" #include "ntqframe.h" #include "ntqlabel.h" diff --git a/src/kernel/ntqnamespace.h b/src/kernel/ntqnamespace.h index 8bdc0a37..03c58309 100644 --- a/src/kernel/ntqnamespace.h +++ b/src/kernel/ntqnamespace.h @@ -920,7 +920,7 @@ public: LogText }; - // Documented in qtextedit.cpp + // Documented in tqtextedit.cpp enum AnchorAttribute { AnchorName, AnchorHref diff --git a/src/kernel/ntqt.h b/src/kernel/ntqt.h index 876d07c1..3e62736f 100644 --- a/src/kernel/ntqt.h +++ b/src/kernel/ntqt.h @@ -36,7 +36,7 @@ #include "tqpair.h" #include "ntqpoint.h" #include <stdio.h> -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqfontinfo.h" #include "ntqsizepolicy.h" #include "ntqtl.h" @@ -65,7 +65,7 @@ #include "ntqpalette.h" #include "tqwidget.h" #include "ntqjpunicode.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqpixmap.h" #include <ntqtabbar.h> #include "ntqiconset.h" @@ -224,18 +224,18 @@ #include <ntqinterlacestyle.h> #include <ntqstylefactory.h> #include <ntqstyleplugin.h> -#include "ntqtextedit.h" +#include "tqtextedit.h" #include <ntqsyntaxhighlighter.h> #include <ntqtabdialog.h> #include "tqsqleditorfactory.h" #include <ntqtabwidget.h> -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> #include <ntqbig5codec.h> -#include <ntqtextcodecfactory.h> -#include <ntqtextcodecplugin.h> +#include <tqtextcodecfactory.h> +#include <tqtextcodecplugin.h> #include <ntqmultilineedit.h> #include "ntqtoolbar.h" -#include <ntqtextview.h> +#include <tqtextview.h> #include "ntqwaitcondition.h" #include <ntqasyncio.h> #include <ntqfontdatabase.h> @@ -295,7 +295,7 @@ #include "private/qrichtext_p.h" #include "private/qsvgdevice_p.h" #include "private/qfontcodecs_p.h" -#include "private/qtextcodecinterface_p.h" +#include "private/tqtextcodecinterface_p.h" #include "private/qpsprinter_p.h" #include "private/qtitlebar_p.h" #include "private/qucom_p.h" @@ -325,7 +325,7 @@ #endif #ifdef TQ_WS_QWS -#include <private/qtextengine_p.h> +#include <private/tqtextengine_p.h> #include "qfontmanager_qws.h" #include <qfontfactorybdf_qws.h> #include <qgfxvoodoodefs_qws.h> diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index e5b28642..baf5ba49 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -49,7 +49,7 @@ #include "ntqcleanuphandler.h" #include "ntqtranslator.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqsessionmanager.h" #include "ntqdragobject.h" #include "ntqclipboard.h" diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index 57c55feb..0cfd812c 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -74,7 +74,7 @@ #include "ntqpainter.h" #include "ntqpixmapcache.h" #include "ntqdatetime.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqdatastream.h" #include "ntqbuffer.h" #include "ntqsocketnotifier.h" diff --git a/src/kernel/qclipboard_x11.cpp b/src/kernel/qclipboard_x11.cpp index 51fbc63a..7776cf60 100644 --- a/src/kernel/qclipboard_x11.cpp +++ b/src/kernel/qclipboard_x11.cpp @@ -70,7 +70,7 @@ #include "ntqdatetime.h" #include "ntqdragobject.h" #include "ntqbuffer.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "tqvaluelist.h" #include "tqmap.h" #include "qt_x11_p.h" diff --git a/src/kernel/qdragobject.cpp b/src/kernel/qdragobject.cpp index 5e6a0dab..9854c33a 100644 --- a/src/kernel/qdragobject.cpp +++ b/src/kernel/qdragobject.cpp @@ -46,7 +46,7 @@ #ifndef TQT_NO_MIME #include "ntqdragobject.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqapplication.h" #include "ntqpoint.h" #include "tqwidget.h" diff --git a/src/kernel/qfont.cpp b/src/kernel/qfont.cpp index b442a325..387f75df 100644 --- a/src/kernel/qfont.cpp +++ b/src/kernel/qfont.cpp @@ -59,7 +59,7 @@ #include "qfontdata_p.h" #include "qfontengine_p.h" #include "qpainter_p.h" -#include "qtextengine_p.h" +#include "tqtextengine_p.h" // #define TQFONTCACHE_DEBUG #ifdef TQFONTCACHE_DEBUG diff --git a/src/kernel/qfont_x11.cpp b/src/kernel/qfont_x11.cpp index 3cd207c6..07c3fe2c 100644 --- a/src/kernel/qfont_x11.cpp +++ b/src/kernel/qfont_x11.cpp @@ -52,13 +52,13 @@ #include "ntqfontmetrics.h" #include "ntqpaintdevice.h" #include "ntqpaintdevicemetrics.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include <private/qfontcodecs_p.h> #include <private/qunicodetables_p.h> #include "qfontdata_p.h" #include "qfontengine_p.h" -#include "qtextengine_p.h" +#include "tqtextengine_p.h" #include "qt_x11_p.h" diff --git a/src/kernel/qfontengine_p.h b/src/kernel/qfontengine_p.h index 17aa618b..9e3c3126 100644 --- a/src/kernel/qfontengine_p.h +++ b/src/kernel/qfontengine_p.h @@ -46,7 +46,7 @@ #include "tqptrdict.h" #endif -#include "qtextengine_p.h" +#include "tqtextengine_p.h" class TQPaintDevice; @@ -475,7 +475,7 @@ class TQTextEngine; #ifndef TQT_NO_XFTFREETYPE #include "qscriptengine_p.h" -#include "qtextengine_p.h" +#include "tqtextengine_p.h" #include <ft2build.h> #include FT_FREETYPE_H #include "ftxopen.h" diff --git a/src/kernel/qfontengine_x11.cpp b/src/kernel/qfontengine_x11.cpp index 5cf75626..54bedb33 100644 --- a/src/kernel/qfontengine_x11.cpp +++ b/src/kernel/qfontengine_x11.cpp @@ -42,7 +42,7 @@ #include <tqwidget.h> #include <ntqcstring.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include "ntqbitmap.h" #include "ntqfontdatabase.h" @@ -54,7 +54,7 @@ #include "qt_x11_p.h" #include "ntqfont.h" -#include "qtextengine_p.h" +#include "tqtextengine_p.h" #include <private/qunicodetables_p.h> diff --git a/src/kernel/qpainter.cpp b/src/kernel/qpainter.cpp index 3f91a802..82840cc2 100644 --- a/src/kernel/qpainter.cpp +++ b/src/kernel/qpainter.cpp @@ -56,7 +56,7 @@ #endif #include <string.h> -#include "qtextlayout_p.h" +#include "tqtextlayout_p.h" #include "qfontengine_p.h" #ifndef TQT_NO_TRANSFORMATIONS diff --git a/src/kernel/qpainter_x11.cpp b/src/kernel/qpainter_x11.cpp index a4f71fc0..0e72d64d 100644 --- a/src/kernel/qpainter_x11.cpp +++ b/src/kernel/qpainter_x11.cpp @@ -45,15 +45,15 @@ #include "tqwidget.h" #include "ntqbitmap.h" #include "ntqpixmapcache.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqpaintdevicemetrics.h" #include "qt_x11_p.h" -#include "qtextlayout_p.h" +#include "tqtextlayout_p.h" #include "qfontdata_p.h" #include "qfontengine_p.h" -#include "qtextengine_p.h" +#include "tqtextengine_p.h" #include <math.h> @@ -435,7 +435,7 @@ static void init_gc_cache() // #define GC_CACHE_STAT #if defined(GC_CACHE_STAT) -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqbuffer.h" static int g_numhits = 0; diff --git a/src/kernel/qpsprinter.cpp b/src/kernel/qpsprinter.cpp index 6974fdf6..22acd983 100644 --- a/src/kernel/qpsprinter.cpp +++ b/src/kernel/qpsprinter.cpp @@ -67,7 +67,7 @@ #include "ntqfile.h" #include "ntqbuffer.h" #include "ntqintdict.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqsettings.h" #include "tqmap.h" #include "ntqfontdatabase.h" @@ -98,8 +98,8 @@ #if defined( TQ_WS_X11 ) || defined (TQ_WS_QWS) #include "qfontdata_p.h" #include "qfontengine_p.h" -#include "qtextlayout_p.h" -#include "qtextengine_p.h" +#include "tqtextlayout_p.h" +#include "tqtextengine_p.h" extern bool tqt_has_xft; #endif diff --git a/src/kernel/qpsprinter_p.h b/src/kernel/qpsprinter_p.h index 6b96a965..47939b1d 100644 --- a/src/kernel/qpsprinter_p.h +++ b/src/kernel/qpsprinter_p.h @@ -59,7 +59,7 @@ #ifndef QT_H #include "ntqprinter.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #endif // QT_H #ifndef TQT_NO_PRINTER diff --git a/src/kernel/qrichtext.cpp b/src/kernel/qrichtext.cpp index 484553d3..cd4c3105 100644 --- a/src/kernel/qrichtext.cpp +++ b/src/kernel/qrichtext.cpp @@ -45,7 +45,7 @@ #include "tqstringlist.h" #include "ntqfont.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqfile.h" #include "ntqapplication.h" #include "tqmap.h" @@ -62,7 +62,7 @@ #include "tqptrdict.h" #include "ntqstyle.h" #include "ntqcleanuphandler.h" -#include "qtextengine_p.h" +#include "tqtextengine_p.h" #include <private/qunicodetables_p.h> #include <stdlib.h> diff --git a/src/kernel/qrichtext_p.h b/src/kernel/qrichtext_p.h index 52762c6b..58fed982 100644 --- a/src/kernel/qrichtext_p.h +++ b/src/kernel/qrichtext_p.h @@ -118,7 +118,7 @@ public: enum Type { Regular=0, Custom=1, Anchor=2, CustomAnchor=3 }; TQChar c; - // this is the same struct as in qtextengine_p.h. Don't change! + // this is the same struct as in tqtextengine_p.h. Don't change! uchar softBreak :1; // Potential linebreak point uchar whiteSpace :1; // A unicode whitespace character, except NBSP, ZWNBSP uchar charStop :1; // Valid cursor position (for left/right arrow) diff --git a/src/kernel/qscriptengine.cpp b/src/kernel/qscriptengine.cpp index 08cac102..5e18dad5 100644 --- a/src/kernel/qscriptengine.cpp +++ b/src/kernel/qscriptengine.cpp @@ -40,7 +40,7 @@ #include "ntqrect.h" #include "ntqfont.h" #include <private/qunicodetables_p.h> -#include "qtextengine_p.h" +#include "tqtextengine_p.h" #include "qfontengine_p.h" #include <stdlib.h> diff --git a/src/kernel/qscriptengine_p.h b/src/kernel/qscriptengine_p.h index 1c5d5537..77dd87b9 100644 --- a/src/kernel/qscriptengine_p.h +++ b/src/kernel/qscriptengine_p.h @@ -48,7 +48,7 @@ // We mean it. // -#include "qtextengine_p.h" +#include "tqtextengine_p.h" class TQString; struct TQCharAttributes; diff --git a/src/kernel/qscriptengine_x11.cpp b/src/kernel/qscriptengine_x11.cpp index 97ae6828..6c1190fb 100644 --- a/src/kernel/qscriptengine_x11.cpp +++ b/src/kernel/qscriptengine_x11.cpp @@ -1899,7 +1899,7 @@ static void indic_attributes(int script, const TQString &text, int from, int len // // -------------------------------------------------------------------------------------------------------------------------------------------- -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <ntqlibrary.h> diff --git a/src/kernel/qt_kernel.pri b/src/kernel/qt_kernel.pri index cf370058..5f20c711 100644 --- a/src/kernel/qt_kernel.pri +++ b/src/kernel/qt_kernel.pri @@ -94,9 +94,9 @@ kernel { $$KERNEL_H/ntqgplugin.h \ $$KERNEL_H/ntqsimplerichtext.h \ $$KERNEL_CPP/qscriptengine_p.h \ - $$KERNEL_CPP/qtextengine_p.h \ + $$KERNEL_CPP/tqtextengine_p.h \ $$KERNEL_CPP/qfontengine_p.h \ - $$KERNEL_CPP/qtextlayout_p.h + $$KERNEL_CPP/tqtextlayout_p.h inputmethod { unix:x11 { @@ -264,8 +264,8 @@ kernel { $$KERNEL_CPP/qgplugin.cpp \ $$KERNEL_CPP/qsimplerichtext.cpp \ $$KERNEL_CPP/qscriptengine.cpp \ - $$KERNEL_CPP/qtextlayout.cpp \ - $$KERNEL_CPP/qtextengine.cpp + $$KERNEL_CPP/tqtextlayout.cpp \ + $$KERNEL_CPP/tqtextengine.cpp unix:HEADERS += $$KERNEL_P/qpsprinter_p.h \ $$KERNEL_H/ntqfontdatabase.h diff --git a/src/kernel/qtextengine.cpp b/src/kernel/qtextengine.cpp deleted file mode 100644 index e1a806f5..00000000 --- a/src/kernel/qtextengine.cpp +++ /dev/null @@ -1,1180 +0,0 @@ -/**************************************************************************** -** -** Text engine classes -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "qtextengine_p.h" - -#include "qscriptengine_p.h" -#include <ntqfont.h> -#include "qfontdata_p.h" -#include "qfontengine_p.h" -#include <tqstring.h> -#include <private/qunicodetables_p.h> -#include <stdlib.h> - -// ----------------------------------------------------------------------------------------------------- -// -// The BiDi algorithm -// -// ----------------------------------------------------------------------------------------------------- - - -#define BIDI_DEBUG 0//2 -#if (BIDI_DEBUG >= 1) -#include <iostream> -using namespace std; - -static const char *directions[] = { - "DirL", "DirR", "DirEN", "DirES", "DirET", "DirAN", "DirCS", "DirB", "DirS", "DirWS", "DirON", - "DirLRE", "DirLRO", "DirAL", "DirRLE", "DirRLO", "DirPDF", "DirNSM", "DirBN" -}; - -#endif - -struct BidiStatus { - BidiStatus() { - eor = TQChar::DirON; - lastStrong = TQChar::DirON; - last = TQChar:: DirON; - dir = TQChar::DirON; - } - TQChar::Direction eor; - TQChar::Direction lastStrong; - TQChar::Direction last; - TQChar::Direction dir; -}; - -struct BidiControl { - struct Context { - unsigned char level : 6; - unsigned char override : 1; - unsigned char unused : 1; - }; - - inline BidiControl( bool rtl ) - : cCtx( 0 ), singleLine( FALSE ) { - ctx[0].level = (rtl ? 1 : 0); - ctx[0].override = FALSE; - } - - inline void embed( int level, bool override = FALSE ) { - if ( ctx[cCtx].level < 61 && cCtx < 61 ) { - (void) ++cCtx; - ctx[cCtx].level = level; - ctx[cCtx].override = override; - } - } - inline void pdf() { - if ( cCtx ) (void) --cCtx; - } - - inline uchar level() const { - return ctx[cCtx].level; - } - inline bool override() const { - return ctx[cCtx].override; - } - inline TQChar::Direction basicDirection() { - return (ctx[0].level ? TQChar::DirR : TQChar:: DirL ); - } - inline uchar baseLevel() { - return ctx[0].level; - } - inline TQChar::Direction direction() { - return ((ctx[cCtx].level%2) ? TQChar::DirR : TQChar:: DirL ); - } - - Context ctx[63]; - unsigned int cCtx : 8; - bool singleLine : 8; -}; - -static TQChar::Direction basicDirection( const TQString &str ) -{ - int len = str.length(); - int pos = 0; - const TQChar *uc = str.unicode() + pos; - while( pos < len ) { - switch( direction( *uc ) ) - { - case TQChar::DirL: - case TQChar::DirLRO: - case TQChar::DirLRE: - return TQChar::DirL; - case TQChar::DirR: - case TQChar::DirAL: - case TQChar::DirRLO: - case TQChar::DirRLE: - return TQChar::DirR; - default: - break; - } - ++pos; - ++uc; - } - return TQChar::DirL; -} - - -static void tqAppendItems(TQTextEngine *engine, int &start, int &stop, BidiControl &control, TQChar::Direction dir ) -{ - TQScriptItemArray &items = engine->items; - const TQChar *text = engine->string.unicode(); - - if ( start > stop ) { - // #### the algorithm is currently not really safe against this. Still needs fixing. -// tqWarning( "Bidi: appendItems() internal error" ); - return; - } - - int level = control.level(); - - if(dir != TQChar::DirON && !control.override()) { - // add level of run (cases I1 & I2) - if( level % 2 ) { - if(dir == TQChar::DirL || dir == TQChar::DirAN || dir == TQChar::DirEN ) - level++; - } else { - if( dir == TQChar::DirR ) - level++; - else if( dir == TQChar::DirAN || dir == TQChar::DirEN ) - level += 2; - } - } - -#if (BIDI_DEBUG >= 1) - tqDebug("new run: dir=%s from %d, to %d level = %d\n", directions[dir], start, stop, level); -#endif - TQFont::Script script = TQFont::NoScript; - TQScriptItem item; - item.position = start; - item.analysis.script = script; - item.analysis.bidiLevel = level; - item.analysis.override = control.override(); - item.analysis.reserved = 0; - - if ( control.singleLine ) { - for ( int i = start; i <= stop; i++ ) { - - unsigned short uc = text[i].unicode(); - TQFont::Script s = (TQFont::Script)scriptForChar( uc ); - if (s == TQFont::UnknownScript || s == TQFont::CombiningMarks) - s = script; - - if (s != script) { - item.analysis.script = s; - item.analysis.bidiLevel = level; - item.position = i; - items.append( item ); - script = s; - } - } - } else { - for ( int i = start; i <= stop; i++ ) { - - unsigned short uc = text[i].unicode(); - TQFont::Script s = (TQFont::Script)scriptForChar( uc ); - if (s == TQFont::UnknownScript || s == TQFont::CombiningMarks) - s = script; - - TQChar::Category category = ::category( uc ); - if ( uc == 0xfffcU || uc == 0x2028U ) { - item.analysis.bidiLevel = level % 2 ? level-1 : level; - item.analysis.script = TQFont::Latin; - item.isObject = TRUE; - s = TQFont::NoScript; - } else if ((uc >= 9 && uc <=13) || - (category >= TQChar::Separator_Space && category <= TQChar::Separator_Paragraph)) { - item.analysis.script = TQFont::Latin; - item.isSpace = TRUE; - item.isTab = ( uc == '\t' ); - item.analysis.bidiLevel = item.isTab ? control.baseLevel() : level; - s = TQFont::NoScript; - } else if ( s != script && (category != TQChar::Mark_NonSpacing || script == TQFont::NoScript)) { - item.analysis.script = s; - item.analysis.bidiLevel = level; - } else { - if (i - start < 32000) - continue; - start = i; - } - - item.position = i; - items.append( item ); - script = s; - item.isSpace = item.isTab = item.isObject = FALSE; - } - } - ++stop; - start = stop; -} - -typedef void (* fAppendItems)(TQTextEngine *, int &start, int &stop, BidiControl &control, TQChar::Direction dir); -static fAppendItems appendItems = tqAppendItems; - -// creates the next TQScript items. -static void bidiItemize( TQTextEngine *engine, bool rightToLeft, int mode ) -{ - BidiControl control( rightToLeft ); - if ( mode & TQTextEngine::SingleLine ) - control.singleLine = TRUE; - - int sor = 0; - int eor = -1; - - // ### should get rid of this! - bool first = TRUE; - - int length = engine->string.length(); - - if ( !length ) - return; - - const TQChar *unicode = engine->string.unicode(); - int current = 0; - - TQChar::Direction dir = rightToLeft ? TQChar::DirR : TQChar::DirL; - BidiStatus status; - TQChar::Direction sdir = direction( *unicode ); - if ( sdir != TQChar::DirL && sdir != TQChar::DirR && sdir != TQChar::DirAL && sdir != TQChar::DirEN && sdir != TQChar::DirAN ) - sdir = TQChar::DirON; - else - dir = TQChar::DirON; - status.eor = sdir; - status.lastStrong = rightToLeft ? TQChar::DirR : TQChar::DirL; - status.last = status.lastStrong; - status.dir = sdir; -#if (BIDI_DEBUG >= 2) - tqDebug("---- bidiReorder --- '%s'", engine->string.utf8().data()); - tqDebug("rightToLeft = %d", rightToLeft); -#endif - - - while ( current <= length ) { - - TQChar::Direction dirCurrent; - if ( current == (int)length ) - dirCurrent = control.basicDirection(); - else - dirCurrent = direction( unicode[current] ); - -#if (BIDI_DEBUG >= 2) - cout << "pos=" << current << " dir=" << directions[dir] - << " current=" << directions[dirCurrent] << " last=" << directions[status.last] - << " eor=" << eor << "/" << directions[status.eor] - << " sor=" << sor << " lastStrong=" - << directions[status.lastStrong] - << " level=" << (int)control.level() << endl; -#endif - - switch(dirCurrent) { - - // embedding and overrides (X1-X9 in the BiDi specs) - case TQChar::DirRLE: - case TQChar::DirRLO: - case TQChar::DirLRE: - case TQChar::DirLRO: - { - bool rtl = (dirCurrent == TQChar::DirRLE || dirCurrent == TQChar::DirRLO ); - bool override = (dirCurrent == TQChar::DirLRO || dirCurrent == TQChar::DirRLO ); - - uchar level = control.level(); - if( (level%2 != 0) == rtl ) - level += 2; - else - level++; - if(level < 61) { - eor = current-1; - appendItems(engine, sor, eor, control, dir); - eor = current; - control.embed( level, override ); - TQChar::Direction edir = (rtl ? TQChar::DirR : TQChar::DirL ); - dir = status.eor = edir; - status.lastStrong = edir; - } - break; - } - case TQChar::DirPDF: - { - if (dir != control.direction()) { - eor = current-1; - appendItems(engine, sor, eor, control, dir); - dir = control.direction(); - } - eor = current; - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirON; - status.last = control.direction(); - control.pdf(); - if ( control.override() ) - dir = control.direction(); - else - dir = TQChar::DirON; - status.lastStrong = control.direction(); - break; - } - - // strong types - case TQChar::DirL: - if(dir == TQChar::DirON) - dir = TQChar::DirL; - switch(status.last) - { - case TQChar::DirL: - eor = current; status.eor = TQChar::DirL; break; - case TQChar::DirR: - case TQChar::DirAL: - case TQChar::DirEN: - case TQChar::DirAN: - if ( !first ) { - appendItems(engine, sor, eor, control, dir); - dir = eor < length ? direction( unicode[eor] ) : control.basicDirection(); - status.eor = dir; - } else { - eor = current; status.eor = dir; - } - break; - case TQChar::DirES: - case TQChar::DirET: - case TQChar::DirCS: - case TQChar::DirBN: - case TQChar::DirB: - case TQChar::DirS: - case TQChar::DirWS: - case TQChar::DirON: - if(dir != TQChar::DirL) { - //last stuff takes embedding dir - if( control.direction() == TQChar::DirR ) { - if(status.eor != TQChar::DirR) { - // AN or EN - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirON; - dir = TQChar::DirR; - } - eor = current - 1; - appendItems(engine, sor, eor, control, dir); - dir = eor < length ? direction( unicode[eor] ) : control.basicDirection(); - status.eor = dir; - } else { - if(status.eor != TQChar::DirL) { - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirON; - dir = TQChar::DirL; - } else { - eor = current; status.eor = TQChar::DirL; break; - } - } - } else { - eor = current; status.eor = TQChar::DirL; - } - default: - break; - } - status.lastStrong = TQChar::DirL; - break; - case TQChar::DirAL: - case TQChar::DirR: - if(dir == TQChar::DirON) dir = TQChar::DirR; - switch(status.last) - { - case TQChar::DirL: - case TQChar::DirEN: - case TQChar::DirAN: - if ( !first ) { - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirON; - break; - } - case TQChar::DirR: - case TQChar::DirAL: - eor = current; status.eor = TQChar::DirR; break; - case TQChar::DirES: - case TQChar::DirET: - case TQChar::DirCS: - case TQChar::DirBN: - case TQChar::DirB: - case TQChar::DirS: - case TQChar::DirWS: - case TQChar::DirON: - if( status.eor != TQChar::DirR && status.eor != TQChar::DirAL ) { - //last stuff takes embedding dir - if(control.direction() == TQChar::DirR - || status.lastStrong == TQChar::DirR || status.lastStrong == TQChar::DirAL) { - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirON; - dir = TQChar::DirR; - eor = current; - } else { - eor = current - 1; - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirON; - dir = TQChar::DirR; - } - } else { - eor = current; status.eor = TQChar::DirR; - } - default: - break; - } - status.lastStrong = dirCurrent; - break; - - // weak types: - - case TQChar::DirNSM: - if (eor == current-1) - eor = current; - break; - case TQChar::DirEN: - // if last strong was AL change EN to AN - if(status.lastStrong != TQChar::DirAL) { - if(dir == TQChar::DirON) { - if(status.lastStrong == TQChar::DirL) - dir = TQChar::DirL; - else - dir = TQChar::DirEN; - } - switch(status.last) - { - case TQChar::DirET: - if ( status.lastStrong == TQChar::DirR || status.lastStrong == TQChar::DirAL ) { - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirON; - dir = TQChar::DirAN; - } - // fall through - case TQChar::DirEN: - case TQChar::DirL: - eor = current; - status.eor = dirCurrent; - break; - case TQChar::DirR: - case TQChar::DirAL: - case TQChar::DirAN: - if ( !first ) - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirEN; - dir = TQChar::DirAN; break; - case TQChar::DirES: - case TQChar::DirCS: - if(status.eor == TQChar::DirEN || dir == TQChar::DirAN) { - eor = current; break; - } - case TQChar::DirBN: - case TQChar::DirB: - case TQChar::DirS: - case TQChar::DirWS: - case TQChar::DirON: - if(status.eor == TQChar::DirR) { - // neutrals go to R - eor = current - 1; - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirEN; - dir = TQChar::DirAN; - } - else if( status.eor == TQChar::DirL || - (status.eor == TQChar::DirEN && status.lastStrong == TQChar::DirL)) { - eor = current; status.eor = dirCurrent; - } else { - // numbers on both sides, neutrals get right to left direction - if(dir != TQChar::DirL) { - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirON; - eor = current - 1; - dir = TQChar::DirR; - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirON; - dir = TQChar::DirAN; - } else { - eor = current; status.eor = dirCurrent; - } - } - default: - break; - } - break; - } - case TQChar::DirAN: - dirCurrent = TQChar::DirAN; - if(dir == TQChar::DirON) dir = TQChar::DirAN; - switch(status.last) - { - case TQChar::DirL: - case TQChar::DirAN: - eor = current; status.eor = TQChar::DirAN; break; - case TQChar::DirR: - case TQChar::DirAL: - case TQChar::DirEN: - if ( !first ) - appendItems(engine, sor, eor, control, dir); - dir = TQChar::DirON; status.eor = TQChar::DirAN; - break; - case TQChar::DirCS: - if(status.eor == TQChar::DirAN) { - eor = current; break; - } - case TQChar::DirES: - case TQChar::DirET: - case TQChar::DirBN: - case TQChar::DirB: - case TQChar::DirS: - case TQChar::DirWS: - case TQChar::DirON: - if(status.eor == TQChar::DirR) { - // neutrals go to R - eor = current - 1; - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirAN; - dir = TQChar::DirAN; - } else if( status.eor == TQChar::DirL || - (status.eor == TQChar::DirEN && status.lastStrong == TQChar::DirL)) { - eor = current; status.eor = dirCurrent; - } else { - // numbers on both sides, neutrals get right to left direction - if(dir != TQChar::DirL) { - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirON; - eor = current - 1; - dir = TQChar::DirR; - appendItems(engine, sor, eor, control, dir); - status.eor = TQChar::DirAN; - dir = TQChar::DirAN; - } else { - eor = current; status.eor = dirCurrent; - } - } - default: - break; - } - break; - case TQChar::DirES: - case TQChar::DirCS: - break; - case TQChar::DirET: - if(status.last == TQChar::DirEN) { - dirCurrent = TQChar::DirEN; - eor = current; status.eor = dirCurrent; - } - break; - - // boundary neutrals should be ignored - case TQChar::DirBN: - break; - // neutrals - case TQChar::DirB: - // ### what do we do with newline and paragraph separators that come to here? - break; - case TQChar::DirS: - // ### implement rule L1 - break; - case TQChar::DirWS: - case TQChar::DirON: - break; - default: - break; - } - - //cout << " after: dir=" << // dir << " current=" << dirCurrent << " last=" << status.last << " eor=" << status.eor << " lastStrong=" << status.lastStrong << " embedding=" << control.direction() << endl; - - if(current >= (int)length) break; - - // set status.last as needed. - switch(dirCurrent) { - case TQChar::DirET: - case TQChar::DirES: - case TQChar::DirCS: - case TQChar::DirS: - case TQChar::DirWS: - case TQChar::DirON: - switch(status.last) - { - case TQChar::DirL: - case TQChar::DirR: - case TQChar::DirAL: - case TQChar::DirEN: - case TQChar::DirAN: - status.last = dirCurrent; - break; - default: - status.last = TQChar::DirON; - } - break; - case TQChar::DirNSM: - case TQChar::DirBN: - // ignore these - break; - case TQChar::DirLRO: - case TQChar::DirLRE: - status.last = TQChar::DirL; - break; - case TQChar::DirRLO: - case TQChar::DirRLE: - status.last = TQChar::DirR; - break; - case TQChar::DirEN: - if ( status.last == TQChar::DirL ) { - status.last = TQChar::DirL; - break; - } - // fall through - default: - status.last = dirCurrent; - } - - first = FALSE; - ++current; - } - -#if (BIDI_DEBUG >= 1) - cout << "reached end of line current=" << current << ", eor=" << eor << endl; -#endif - eor = current - 1; // remove dummy char - - if ( sor <= eor ) - appendItems(engine, sor, eor, control, dir); - - -} - -void TQTextEngine::bidiReorder( int numItems, const TQ_UINT8 *levels, int *visualOrder ) -{ - - // first find highest and lowest levels - uchar levelLow = 128; - uchar levelHigh = 0; - int i = 0; - while ( i < numItems ) { - //printf("level = %d\n", r->level); - if ( levels[i] > levelHigh ) - levelHigh = levels[i]; - if ( levels[i] < levelLow ) - levelLow = levels[i]; - i++; - } - - // implements reordering of the line (L2 according to BiDi spec): - // L2. From the highest level found in the text to the lowest odd level on each line, - // reverse any contiguous sequence of characters that are at that level or higher. - - // reversing is only done up to the lowest odd level - if(!(levelLow%2)) levelLow++; - -#if (BIDI_DEBUG >= 1) - cout << "reorderLine: lineLow = " << (uint)levelLow << ", lineHigh = " << (uint)levelHigh << endl; -#endif - - int count = numItems - 1; - for ( i = 0; i < numItems; i++ ) - visualOrder[i] = i; - - while(levelHigh >= levelLow) { - int i = 0; - while ( i < count ) { - while(i < count && levels[i] < levelHigh) i++; - int start = i; - while(i <= count && levels[i] >= levelHigh) i++; - int end = i-1; - - if(start != end) { - //cout << "reversing from " << start << " to " << end << endl; - for(int j = 0; j < (end-start+1)/2; j++) { - int tmp = visualOrder[start+j]; - visualOrder[start+j] = visualOrder[end-j]; - visualOrder[end-j] = tmp; - } - } - i++; - } - levelHigh--; - } - -#if (BIDI_DEBUG >= 1) - cout << "visual order is:" << endl; - for ( i = 0; i < numItems; i++ ) - cout << visualOrder[i] << endl; -#endif -} - - -// ----------------------------------------------------------------------------------------------------- -// -// The line break algorithm. See http://www.unicode.org/reports/tr14/tr14-13.html -// -// ----------------------------------------------------------------------------------------------------- - -/* The Unicode algorithm does in our opinion allow line breaks at some - places they shouldn't be allowed. The following changes were thus - made in comparison to the Unicode reference: - - CL->AL from Dbk to Ibk - CL->PR from Dbk to Ibk - EX->AL from Dbk to Ibk - IS->AL from Dbk to Ibk - PO->AL from Dbk to Ibk - SY->AL from Dbk to Ibk - SY->PO from Dbk to Ibk - SY->PR from Dbk to Ibk - SY->OP from Dbk to Ibk - Al->OP from Dbk to Ibk - AL->HY from Dbk to Ibk - AL->PR from Dbk to Ibk - AL->PO from Dbk to Ibk - PR->PR from Dbk to Ibk - PO->PO from Dbk to Ibk - PR->PO from Dbk to Ibk - PO->PR from Dbk to Ibk - HY->PO from Dbk to Ibk - HY->PR from Dbk to Ibk - HY->OP from Dbk to Ibk - PO->OP from Dbk to Ibk - NU->EX from Dbk to Ibk - NU->PR from Dbk to Ibk - PO->NU from Dbk to Ibk - EX->PO from Dbk to Ibk -*/ - -enum break_action { - Dbk, // Direct break - Ibk, // Indirect break; only allowed if space between the two chars - Pbk // Prohibited break; no break allowed even if space between chars -}; - -// The following line break classes are not treated by the table: -// SA, BK, CR, LF, SG, CB, SP -static const TQ_UINT8 breakTable[TQUnicodeTables::LineBreak_CM+1][TQUnicodeTables::LineBreak_CM+1] = -{ - // OP, CL, QU, GL, NS, EX, SY, IS, PR, PO, NU, AL, ID, IN, HY, BA, BB, B2, ZW, CM - { Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk }, // OP - { Dbk, Pbk, Ibk, Pbk, Pbk, Pbk, Pbk, Pbk, Ibk, Ibk, Dbk, Ibk, Dbk, Dbk, Ibk, Ibk, Pbk, Pbk, Pbk, Pbk }, // CL - { Pbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Pbk }, // QU - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Pbk }, // GL - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // NS - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // EX - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // SY - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // IS - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk }, // PR - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // PO - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk }, // NU - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk }, // AL - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Ibk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // ID - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // IN - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // HY - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // BA - { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Ibk }, // BB - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Pbk, Pbk, Ibk }, // B2 - { Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Pbk, Ibk }, // ZW - { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Ibk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk } // CM -}; - -// set the soft break flag at every possible line breaking point. This needs correct clustering information. -static void calcLineBreaks(const TQString &str, TQCharAttributes *charAttributes) -{ - int len = str.length(); - if (!len) - return; - - const TQChar *uc = str.unicode(); - int cls = lineBreakClass(*uc); - if (cls >= TQUnicodeTables::LineBreak_CM) - cls = TQUnicodeTables::LineBreak_ID; - - charAttributes[0].softBreak = FALSE; - charAttributes[0].whiteSpace = (cls == TQUnicodeTables::LineBreak_SP); - charAttributes[0].charStop = TRUE; - - for (int i = 1; i < len; ++i) { - int ncls = ::lineBreakClass(uc[i]); - int category = ::category(uc[i]); - if (category == TQChar::Mark_NonSpacing) - goto nsm; - - if (category == TQChar::Other_Surrogate) { - // char stop only on first pair - if (uc[i].unicode() >= 0xd800 && uc[i].unicode() < 0xdc00 && i < len-1 - && uc[i+1].unicode() >= 0xdc00 && uc[i+1].unicode() < 0xe000) - goto nsm; - // ### correctly handle second surrogate - } - - if (ncls == TQUnicodeTables::LineBreak_SP) { - charAttributes[i].softBreak = FALSE; - charAttributes[i].whiteSpace = TRUE; - charAttributes[i].charStop = TRUE; - cls = ncls; - continue; - } - - - if (cls == TQUnicodeTables::LineBreak_SA && ncls == TQUnicodeTables::LineBreak_SA) { - // two complex chars (thai or lao), thai_attributes might override, but here - // we do a best guess - charAttributes[i].softBreak = TRUE; - charAttributes[i].whiteSpace = FALSE; - charAttributes[i].charStop = TRUE; - cls = ncls; - continue; - } - { - int tcls = ncls; - if (tcls >= TQUnicodeTables::LineBreak_SA) - tcls = TQUnicodeTables::LineBreak_ID; - if (cls >= TQUnicodeTables::LineBreak_SA) - cls = TQUnicodeTables::LineBreak_ID; - - bool softBreak; - int brk = breakTable[cls][tcls]; - if (brk == Ibk) - softBreak = (cls == TQUnicodeTables::LineBreak_SP); - else - softBreak = (brk == Dbk); -// tqDebug("char = %c %04x, cls=%d, ncls=%d, brk=%d soft=%d", uc[i].cell(), uc[i].unicode(), cls, ncls, brk, charAttributes[i].softBreak); - charAttributes[i].softBreak = softBreak; - charAttributes[i].whiteSpace = FALSE; - charAttributes[i].charStop = TRUE; - cls = ncls; - } - continue; - nsm: - charAttributes[i].softBreak = FALSE; - charAttributes[i].whiteSpace = FALSE; - charAttributes[i].charStop = FALSE; - } -} - -#if defined( TQ_WS_X11 ) || defined ( TQ_WS_QWS ) -# include "qtextengine_unix.cpp" -#elif defined( TQ_WS_WIN ) -# include "qtextengine_win.cpp" -#elif defined( TQ_WS_MAC ) -# include "qtextengine_mac.cpp" -#endif - - - -TQTextEngine::TQTextEngine( const TQString &str, TQFontPrivate *f ) - : string( str ), fnt( f ), direction( TQChar::DirON ), haveCharAttributes( FALSE ), widthOnly( FALSE ) -{ -#ifdef TQ_WS_WIN - if ( !resolvedUsp10 ) - resolveUsp10(); -#endif - if ( fnt ) fnt->ref(); - - num_glyphs = TQMAX( 16, str.length()*3/2 ); - int space_charAttributes = (sizeof(TQCharAttributes)*str.length()+sizeof(void*)-1)/sizeof(void*); - int space_logClusters = (sizeof(unsigned short)*str.length()+sizeof(void*)-1)/sizeof(void*); - int space_glyphs = (sizeof(glyph_t)*num_glyphs+sizeof(void*)-1)/sizeof(void*); - int space_advances = (sizeof(advance_t)*num_glyphs+sizeof(void*)-1)/sizeof(void*); - int space_offsets = (sizeof(qoffset_t)*num_glyphs+sizeof(void*)-1)/sizeof(void*); - int space_glyphAttributes = (sizeof(GlyphAttributes)*num_glyphs+sizeof(void*)-1)/sizeof(void*); - - allocated = space_charAttributes + space_glyphs + space_advances + - space_offsets + space_logClusters + space_glyphAttributes; - memory = (void **)::malloc( allocated*sizeof( void * ) ); - memset( memory, 0, allocated*sizeof( void * ) ); - - void **m = memory; - m += space_charAttributes; - logClustersPtr = (unsigned short *) m; - m += space_logClusters; - glyphPtr = (glyph_t *) m; - m += space_glyphs; - advancePtr = (advance_t *) m; - m += space_advances; - offsetsPtr = (qoffset_t *) m; - m += space_offsets; - glyphAttributesPtr = (GlyphAttributes *) m; - - used = 0; -} - -TQTextEngine::~TQTextEngine() -{ - if ( fnt && fnt->deref()) - delete fnt; - free( memory ); - allocated = 0; -} - -void TQTextEngine::reallocate( int totalGlyphs ) -{ - int new_num_glyphs = totalGlyphs; - int space_charAttributes = (sizeof(TQCharAttributes)*string.length()+sizeof(void*)-1)/sizeof(void*); - int space_logClusters = (sizeof(unsigned short)*string.length()+sizeof(void*)-1)/sizeof(void*); - int space_glyphs = (sizeof(glyph_t)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); - int space_advances = (sizeof(advance_t)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); - int space_offsets = (sizeof(qoffset_t)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); - int space_glyphAttributes = (sizeof(GlyphAttributes)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); - - int newAllocated = space_charAttributes + space_glyphs + space_advances + - space_offsets + space_logClusters + space_glyphAttributes; - void ** newMemory = (void **)::malloc( newAllocated*sizeof( void * ) ); - - void **nm = newMemory; - memcpy( nm, memory, string.length()*sizeof(TQCharAttributes) ); - nm += space_charAttributes; - memcpy( nm, logClustersPtr, num_glyphs*sizeof(unsigned short) ); - logClustersPtr = (unsigned short *) nm; - nm += space_logClusters; - memcpy( nm, glyphPtr, num_glyphs*sizeof(glyph_t) ); - glyphPtr = (glyph_t *) nm; - nm += space_glyphs; - memcpy( nm, advancePtr, num_glyphs*sizeof(advance_t) ); - advancePtr = (advance_t *) nm; - nm += space_advances; - memcpy( nm, offsetsPtr, num_glyphs*sizeof(qoffset_t) ); - offsetsPtr = (qoffset_t *) nm; - nm += space_offsets; - memcpy( nm, glyphAttributesPtr, num_glyphs*sizeof(GlyphAttributes) ); - glyphAttributesPtr = (GlyphAttributes *) nm; - - free( memory ); - memory = newMemory; - allocated = newAllocated; - num_glyphs = new_num_glyphs; -} - -const TQCharAttributes *TQTextEngine::attributes() -{ - TQCharAttributes *charAttributes = (TQCharAttributes *) memory; - if ( haveCharAttributes ) - return charAttributes; - - if ( !items.d ) - itemize(); - - ensureSpace(string.length()); - charAttributes = (TQCharAttributes *) memory; - calcLineBreaks(string, charAttributes); - - for ( int i = 0; i < items.size(); i++ ) { - TQScriptItem &si = items[i]; -#ifdef TQ_WS_WIN - int script = uspScriptForItem(this, i); -#else - int script = si.analysis.script; -#endif - Q_ASSERT( script < TQFont::NScripts ); - AttributeFunction attributes = scriptEngines[script].charAttributes; - if (!attributes) - continue; - int from = si.position; - int len = length( i ); - attributes( script, string, from, len, charAttributes ); - } - - haveCharAttributes = TRUE; - return charAttributes; -} - -void TQTextEngine::splitItem( int item, int pos ) -{ - if ( pos <= 0 ) - return; - - // we have to ensure we get correct shaping for arabic and other - // complex languages so we have to call shape _before_ we split the item. - shape(item); - - if ( items.d->size == items.d->alloc ) - items.resize( items.d->size + 1 ); - - int numMove = items.d->size - item-1; - if ( numMove > 0 ) - memmove( items.d->items + item+2, items.d->items +item+1, numMove*sizeof( TQScriptItem ) ); - items.d->size++; - TQScriptItem &newItem = items.d->items[item+1]; - TQScriptItem &oldItem = items.d->items[item]; - newItem = oldItem; - items.d->items[item+1].position += pos; - if ( newItem.fontEngine ) - newItem.fontEngine->ref(); - - if (oldItem.num_glyphs) { - // already shaped, break glyphs aswell - int breakGlyph = logClusters(&oldItem)[pos]; - - newItem.num_glyphs = oldItem.num_glyphs - breakGlyph; - oldItem.num_glyphs = breakGlyph; - newItem.glyph_data_offset = oldItem.glyph_data_offset + breakGlyph; - - for (int i = 0; i < newItem.num_glyphs; i++) - logClusters(&newItem)[i] -= breakGlyph; - - int w = 0; - const advance_t *a = advances(&oldItem); - for(int j = 0; j < breakGlyph; ++j) - w += *(a++); - - newItem.width = oldItem.width - w; - oldItem.width = w; - } - -// tqDebug("split at position %d itempos=%d", pos, item ); -} - - -int TQTextEngine::width( int from, int len ) const -{ - int w = 0; - -// tqDebug("TQTextEngine::width( from = %d, len = %d ), numItems=%d, strleng=%d", from, len, items.size(), string.length() ); - for ( int i = 0; i < items.size(); i++ ) { - TQScriptItem *si = &items[i]; - int pos = si->position; - int ilen = length( i ); -// tqDebug("item %d: from %d len %d", i, pos, ilen ); - if ( pos >= from + len ) - break; - if ( pos + ilen > from ) { - if ( !si->num_glyphs ) - shape( i ); - - advance_t *advances = this->advances( si ); - unsigned short *logClusters = this->logClusters( si ); - -// fprintf( stderr, " logclusters:" ); -// for ( int k = 0; k < ilen; k++ ) -// fprintf( stderr, " %d", logClusters[k] ); -// fprintf( stderr, "\n" ); - // do the simple thing for now and give the first glyph in a cluster the full width, all other ones 0. - int charFrom = from - pos; - if ( charFrom < 0 ) - charFrom = 0; - int glyphStart = logClusters[charFrom]; - if ( charFrom > 0 && logClusters[charFrom-1] == glyphStart ) - while ( charFrom < ilen && logClusters[charFrom] == glyphStart ) - charFrom++; - if ( charFrom < ilen ) { - glyphStart = logClusters[charFrom]; - int charEnd = from + len - 1 - pos; - if ( charEnd >= ilen ) - charEnd = ilen-1; - int glyphEnd = logClusters[charEnd]; - while ( charEnd < ilen && logClusters[charEnd] == glyphEnd ) - charEnd++; - glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd]; - -// tqDebug("char: start=%d end=%d / glyph: start = %d, end = %d", charFrom, charEnd, glyphStart, glyphEnd ); - for ( int i = glyphStart; i < glyphEnd; i++ ) - w += advances[i]; - } - } - } -// tqDebug(" --> w= %d ", w ); - return w; -} - -void TQTextEngine::itemize( int mode ) -{ - if ( !items.d ) { - int size = 8; - items.d = (TQScriptItemArrayPrivate *)malloc( sizeof( TQScriptItemArrayPrivate ) + - sizeof( TQScriptItem ) * size ); - items.d->alloc = size; - } - items.d->size = 0; - if ( string.length() == 0 ) - return; - - if ( !(mode & NoBidi) ) { - if ( direction == TQChar::DirON ) - direction = basicDirection( string ); - bidiItemize( this, direction == TQChar::DirR, mode ); - } else { - BidiControl control( FALSE ); - if ( mode & TQTextEngine::SingleLine ) - control.singleLine = TRUE; - int start = 0; - int stop = string.length() - 1; - appendItems(this, start, stop, control, TQChar::DirL); - } - if ( (mode & WidthOnly) == WidthOnly ) - widthOnly = TRUE; -} - -glyph_metrics_t TQTextEngine::boundingBox( int from, int len ) const -{ - glyph_metrics_t gm; - - for ( int i = 0; i < items.size(); i++ ) { - TQScriptItem *si = &items[i]; - int pos = si->position; - int ilen = length( i ); - if ( pos > from + len ) - break; - if ( pos + len > from ) { - if ( !si->num_glyphs ) - shape( i ); - advance_t *advances = this->advances( si ); - unsigned short *logClusters = this->logClusters( si ); - glyph_t *glyphs = this->glyphs( si ); - qoffset_t *offsets = this->offsets( si ); - - // do the simple thing for now and give the first glyph in a cluster the full width, all other ones 0. - int charFrom = from - pos; - if ( charFrom < 0 ) - charFrom = 0; - int glyphStart = logClusters[charFrom]; - if ( charFrom > 0 && logClusters[charFrom-1] == glyphStart ) - while ( charFrom < ilen && logClusters[charFrom] == glyphStart ) - charFrom++; - if ( charFrom < ilen ) { - glyphStart = logClusters[charFrom]; - int charEnd = from + len - 1 - pos; - if ( charEnd >= ilen ) - charEnd = ilen-1; - int glyphEnd = logClusters[charEnd]; - while ( charEnd < ilen && logClusters[charEnd] == glyphEnd ) - charEnd++; - glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd]; - if ( glyphStart <= glyphEnd ) { - TQFontEngine *fe = si->fontEngine; - glyph_metrics_t m = fe->boundingBox( glyphs+glyphStart, advances+glyphStart, - offsets+glyphStart, glyphEnd-glyphStart ); - gm.x = TQMIN( gm.x, m.x + gm.xoff ); - gm.y = TQMIN( gm.y, m.y + gm.yoff ); - gm.width = TQMAX( gm.width, m.width+gm.xoff ); - gm.height = TQMAX( gm.height, m.height+gm.yoff ); - gm.xoff += m.xoff; - gm.yoff += m.yoff; - } - } - } - } - return gm; -} diff --git a/src/kernel/qtextengine_p.h b/src/kernel/qtextengine_p.h deleted file mode 100644 index 774302a0..00000000 --- a/src/kernel/qtextengine_p.h +++ /dev/null @@ -1,377 +0,0 @@ -/**************************************************************************** -** -** ??? -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** Licensees holding valid TQt Commercial licenses may use this file in -** accordance with the TQt Commercial License Agreement provided with -** the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTENGINE_P_H -#define TQTEXTENGINE_P_H - -#ifndef QT_H -#include "ntqglobal.h" -#include "tqstring.h" -#include "ntqnamespace.h" -#include <private/qfontdata_p.h> -#endif // QT_H - -#include <stdlib.h> -#ifndef Q_OS_TEMP -#include <assert.h> -#endif // Q_OS_TEMP - -class TQFontPrivate; -class TQString; - -class TQOpenType; -class TQPainter; - -// this uses the same coordinate system as TQt, but a different one to freetype and Xft. -// * y is usually negative, and is equal to the ascent. -// * negative yoff means the following stuff is drawn higher up. -// the characters bounding rect is given by TQRect( x,y,width,height), it's advance by -// xoo and yoff -struct glyph_metrics_t -{ - inline glyph_metrics_t() { - x = 100000; - y = 100000; - width = 0; - height = 0; - xoff = 0; - yoff = 0; - } - inline glyph_metrics_t( int _x, int _y, int _width, int _height, int _xoff, int _yoff ) { - x = _x; - y = _y; - width = _width; - height = _height; - xoff = _xoff; - yoff = _yoff; - } - int x; - int y; - int width; - int height; - int xoff; - int yoff; -}; - -#if defined( TQ_WS_X11 ) || defined ( TQ_WS_QWS ) -typedef unsigned short glyph_t; - -struct qoffset_t { - short x; - short y; -}; - -typedef int advance_t; - -struct TQScriptAnalysis -{ - unsigned short script : 7; - unsigned short bidiLevel : 6; // Unicode Bidi algorithm embedding level (0-61) - unsigned short override : 1; // Set when in LRO/RLO embedding - unsigned short reserved : 2; - bool operator == ( const TQScriptAnalysis &other ) { - return - script == other.script && - bidiLevel == other.bidiLevel; - // ### -// && override == other.override; - } - -}; - -#elif defined( TQ_WS_MAC ) - -typedef unsigned short glyph_t; - -struct qoffset_t { - short x; - short y; -}; - -typedef int advance_t; - -struct TQScriptAnalysis -{ - unsigned short script : 7; - unsigned short bidiLevel : 6; // Unicode Bidi algorithm embedding level (0-61) - unsigned short override : 1; // Set when in LRO/RLO embedding - unsigned short reserved : 2; - bool operator == ( const TQScriptAnalysis &other ) { - return - script == other.script && - bidiLevel == other.bidiLevel; - // ### -// && override == other.override; - } - -}; - -#elif defined( TQ_WS_WIN ) - -// do not change the definitions below unless you know what you are doing! -// it is designed to be compatible with the types found in uniscribe. - -typedef unsigned short glyph_t; - -struct qoffset_t { - int x; - int y; -}; - -typedef int advance_t; - -struct TQScriptAnalysis { - unsigned short script :10; - unsigned short rtl :1; - unsigned short layoutRTL :1; - unsigned short linkBefore :1; - unsigned short linkAfter :1; - unsigned short logicalOrder :1; - unsigned short noGlyphIndex :1; - unsigned short bidiLevel :5; - unsigned short override :1; - unsigned short inhibitSymSwap :1; - unsigned short charShape :1; - unsigned short digitSubstitute :1; - unsigned short inhibitLigate :1; - unsigned short fDisplayZWG :1; - unsigned short arabicNumContext :1; - unsigned short gcpClusters :1; - unsigned short reserved :1; - unsigned short engineReserved :2; -}; - -inline bool operator == ( const TQScriptAnalysis &sa1, const TQScriptAnalysis &sa2 ) -{ - return - sa1.script == sa2.script && - sa1.bidiLevel == sa2.bidiLevel; - // ### -// && override == other.override; -} - -#endif - -// enum and struct are made to be compatible with Uniscribe, dont change unless you know what you're doing. -struct GlyphAttributes { - // highest value means highest priority for justification. Justification is done by first inserting kashidas - // starting with the highest priority positions, then stretching spaces, afterwards extending inter char - // spacing, and last spacing between arabic words. - // NoJustification is for example set for arabic where no Kashida can be inserted or for diacritics. - enum Justification { - NoJustification= 0, // Justification can't be applied after this glyph - Arabic_Space = 1, // This glyph represents a space inside arabic text - Character = 2, // Inter-character justification point follows this glyph - Space = 4, // This glyph represents a blank outside an Arabic run - Arabic_Normal = 7, // Normal Middle-Of-Word glyph that connects to the right (begin) - Arabic_Waw = 8, // Next character is final form of Waw/Ain/Qaf/Fa - Arabic_BaRa = 9, // Next two chars are Ba + Ra/Ya/AlefMaksura - Arabic_Alef = 10, // Next character is final form of Alef/Tah/Lam/Kaf/Gaf - Arabic_HaaDal = 11, // Next character is final form of Haa/Dal/Taa Marbutah - Arabic_Seen = 12, // Initial or Medial form Of Seen/Sad - Arabic_Kashida = 13 // Kashida(U+640) in middle of word - }; - unsigned short justification :4; // Justification class - unsigned short clusterStart :1; // First glyph of representation of cluster - unsigned short mark :1; // needs to be positioned around base char - unsigned short zeroWidth :1; // ZWJ, ZWNJ etc, with no width, currently used as "Don't print" for ZWSP - unsigned short reserved :1; - unsigned short combiningClass :8; -}; - -// also this is compatible to uniscribe. Do not change. -struct TQCharAttributes { - uchar softBreak :1; // Potential linebreak point _before_ this character - uchar whiteSpace :1; // A unicode whitespace character, except NBSP, ZWNBSP - uchar charStop :1; // Valid cursor position (for left/right arrow) - uchar wordStop :1; // Valid cursor position (for ctrl + left/right arrow) - uchar invalid :1; - uchar reserved :3; -}; - -inline bool qIsZeroWidthChar(ushort uc) -{ - return (uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) - || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) - || (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */); -} - -class TQFontEngine; - -struct TQScriptItem -{ - inline TQScriptItem() : position( 0 ), isSpace( FALSE ), isTab( FALSE ), - isObject( FALSE ), hasPositioning( FALSE ), - descent( -1 ), ascent( -1 ), width( -1 ), - x( 0 ), y( 0 ), num_glyphs( 0 ), glyph_data_offset( 0 ), - fontEngine( 0 ) { } - int position; - TQScriptAnalysis analysis; - unsigned short isSpace : 1; - unsigned short isTab : 1; - unsigned short isObject : 1; - unsigned short hasPositioning : 1; - unsigned short complex : 1; // Windows only - unsigned short private_use : 1; // Windows only - unsigned short reserved : 10; - short descent; - int ascent; - int width; - int x; - int y; - int num_glyphs; - int glyph_data_offset; - TQFontEngine *fontEngine; -}; - -struct TQScriptItemArrayPrivate -{ - unsigned int alloc; - unsigned int size; - TQScriptItem items[1]; -}; - -class TQScriptItemArray -{ -public: - TQScriptItemArray() : d( 0 ) {} - ~TQScriptItemArray(); - - inline TQScriptItem &operator[] (int i) const {return d->items[i]; } - inline void append( const TQScriptItem &item ) { - if ( d->size == d->alloc ) - resize( d->size + 1 ); - d->items[d->size] = item; - d->size++; - } - inline int size() const { return d ? d->size : 0; } - - void resize( int s ); - void clear(); - - TQScriptItemArrayPrivate *d; -private: -#ifdef TQ_DISABLE_COPY - TQScriptItemArray( const TQScriptItemArray & ); - TQScriptItemArray &operator = ( const TQScriptItemArray & ); -#endif -}; - -class TQFontPrivate; - -class TQ_EXPORT TQTextEngine { -public: - TQTextEngine( const TQString &str, TQFontPrivate *f ); - ~TQTextEngine(); - - enum Mode { - Full = 0x00, - NoBidi = 0x01, - SingleLine = 0x02, - WidthOnly = 0x07 - }; - - void itemize( int mode = Full ); - - static void bidiReorder( int numRuns, const TQ_UINT8 *levels, int *visualOrder ); - - const TQCharAttributes *attributes(); - void shape( int item ) const; - - // ### we need something for justification - - enum Edge { - Leading, - Trailing - }; - enum ShaperFlag { - RightToLeft = 0x0001, - Mirrored = 0x0001 - }; - - int width( int charFrom, int numChars ) const; - glyph_metrics_t boundingBox( int from, int len ) const; - - TQScriptItemArray items; - TQString string; - TQFontPrivate *fnt; - int lineWidth; - int widthUsed; - int firstItemInLine; - int currentItem; - TQChar::Direction direction : 5; - unsigned int haveCharAttributes : 1; - unsigned int widthOnly : 1; - unsigned int reserved : 25; - - int length( int item ) const { - const TQScriptItem &si = items[item]; - int from = si.position; - item++; - return ( item < items.size() ? items[item].position : string.length() ) - from; - } - void splitItem( int item, int pos ); - - unsigned short *logClustersPtr; - glyph_t *glyphPtr; - advance_t *advancePtr; - qoffset_t *offsetsPtr; - GlyphAttributes *glyphAttributesPtr; - - inline unsigned short *logClusters( const TQScriptItem *si ) const - { return logClustersPtr+si->position; } - inline glyph_t *glyphs( const TQScriptItem *si ) const - { return glyphPtr+si->glyph_data_offset; } - inline advance_t *advances( const TQScriptItem *si ) const - { return advancePtr+si->glyph_data_offset; } - inline qoffset_t *offsets( const TQScriptItem *si ) const - { return offsetsPtr+si->glyph_data_offset; } - inline GlyphAttributes *glyphAttributes( const TQScriptItem *si ) const - { return glyphAttributesPtr+si->glyph_data_offset; } - - void reallocate( int totalGlyphs ); - inline void ensureSpace( int nGlyphs ) const { - if ( num_glyphs - used < nGlyphs ) - ((TQTextEngine *)this)->reallocate( ( (used + nGlyphs + 16) >> 4 ) << 4 ); - } - - int allocated; - void **memory; - int num_glyphs; - int used; -}; - -#endif diff --git a/src/kernel/qtextengine_unix.cpp b/src/kernel/qtextengine_unix.cpp deleted file mode 100644 index 0d5e3b92..00000000 --- a/src/kernel/qtextengine_unix.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Text engine classes -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include <assert.h> - - -TQScriptItemArray::~TQScriptItemArray() -{ - clear(); - free( d ); -} - -void TQScriptItemArray::clear() -{ - if ( d ) { - for ( unsigned int i = 0; i < d->size; i++ ) { - TQScriptItem &si = d->items[i]; - if ( si.fontEngine ) - si.fontEngine->deref(); - } - d->size = 0; - } -} - -void TQScriptItemArray::resize( int s ) -{ - int alloc = (s + 8) >> 3 << 3; - d = (TQScriptItemArrayPrivate *)realloc( d, sizeof( TQScriptItemArrayPrivate ) + - sizeof( TQScriptItem ) * alloc ); - d->alloc = alloc; -} - -void TQTextEngine::shape( int item ) const -{ - assert( item < items.size() ); - TQScriptItem &si = items[item]; - - if ( si.num_glyphs ) - return; - - TQFont::Script script = (TQFont::Script)si.analysis.script; - si.glyph_data_offset = used; - - if ( !si.fontEngine ) - si.fontEngine = fnt->engineForScript( script ); - si.fontEngine->ref(); - - si.ascent = si.fontEngine->ascent(); - si.descent = si.fontEngine->descent(); - si.num_glyphs = 0; - - if ( si.fontEngine && si.fontEngine != (TQFontEngine*)-1 ) { - TQShaperItem shaper_item; - shaper_item.script = si.analysis.script; - shaper_item.string = &string; - shaper_item.from = si.position; - shaper_item.length = length(item); - shaper_item.font = si.fontEngine; - shaper_item.num_glyphs = TQMAX(int(num_glyphs - used), shaper_item.length); - shaper_item.flags = si.analysis.bidiLevel % 2 ? RightToLeft : 0; - shaper_item.has_positioning = FALSE; - - while (1) { -// tqDebug(" . num_glyphs=%d, used=%d, item.num_glyphs=%d", num_glyphs, used, shaper_item.num_glyphs); - ensureSpace(shaper_item.num_glyphs); - shaper_item.num_glyphs = num_glyphs - used; -// tqDebug(" .. num_glyphs=%d, used=%d, item.num_glyphs=%d", num_glyphs, used, shaper_item.num_glyphs); - shaper_item.glyphs = glyphs(&si); - shaper_item.advances = advances(&si); - shaper_item.offsets = offsets(&si); - shaper_item.attributes = glyphAttributes(&si); - shaper_item.log_clusters = logClusters(&si); - if (scriptEngines[shaper_item.script].shape(&shaper_item)) - break; - } - - si.num_glyphs = shaper_item.num_glyphs; - si.hasPositioning = shaper_item.has_positioning; - } - ((TQTextEngine *)this)->used += si.num_glyphs; - - si.width = 0; - advance_t *advances = this->advances( &si ); - advance_t *end = advances + si.num_glyphs; - while ( advances < end ) { -// tqDebug("advances[%d] = %d", advances - this->advances(&si), *advances); - si.width += *(advances++); - } - - return; -} - diff --git a/src/kernel/qtextlayout.cpp b/src/kernel/qtextlayout.cpp deleted file mode 100644 index 777e61ad..00000000 --- a/src/kernel/qtextlayout.cpp +++ /dev/null @@ -1,643 +0,0 @@ -/**************************************************************************** -** -** ??? -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "qtextlayout_p.h" -#include "qtextengine_p.h" - -#include <ntqfont.h> -#include <ntqapplication.h> -#include <ntqpainter.h> - - -TQRect TQTextItem::rect() const -{ - TQScriptItem& si = engine->items[item]; - return TQRect( si.x, si.y, si.width, si.ascent+si.descent ); -} - -int TQTextItem::x() const -{ - return engine->items[item].x; -} - -int TQTextItem::y() const -{ - return engine->items[item].y; -} - -int TQTextItem::width() const -{ - return engine->items[item].width; -} - -int TQTextItem::ascent() const -{ - return engine->items[item].ascent; -} - -int TQTextItem::descent() const -{ - return engine->items[item].descent; -} - -void TQTextItem::setWidth( int w ) -{ - engine->items[item].width = w; -} - -void TQTextItem::setAscent( int a ) -{ - engine->items[item].ascent = a; -} - -void TQTextItem::setDescent( int d ) -{ - engine->items[item].descent = d; -} - -int TQTextItem::from() const -{ - return engine->items[item].position; -} - -int TQTextItem::length() const -{ - return engine->length(item); -} - - -int TQTextItem::cursorToX( int *cPos, Edge edge ) const -{ - int pos = *cPos; - TQScriptItem *si = &engine->items[item]; - - engine->shape( item ); - advance_t *advances = engine->advances( si ); - GlyphAttributes *glyphAttributes = engine->glyphAttributes( si ); - unsigned short *logClusters = engine->logClusters( si ); - - int l = engine->length( item ); - if ( pos > l ) - pos = l; - if ( pos < 0 ) - pos = 0; - - int glyph_pos = pos == l ? si->num_glyphs : logClusters[pos]; - if ( edge == Trailing ) { - // trailing edge is leading edge of next cluster - while ( glyph_pos < si->num_glyphs && !glyphAttributes[glyph_pos].clusterStart ) - glyph_pos++; - } - - int x = 0; - bool reverse = engine->items[item].analysis.bidiLevel % 2; - - if ( reverse ) { - for ( int i = si->num_glyphs-1; i >= glyph_pos; i-- ) - x += advances[i]; - } else { - for ( int i = 0; i < glyph_pos; i++ ) - x += advances[i]; - } -// tqDebug("cursorToX: pos=%d, gpos=%d x=%d", pos, glyph_pos, x ); - *cPos = pos; - return x; -} - -int TQTextItem::xToCursor( int x, CursorPosition cpos ) const -{ - TQScriptItem *si = &engine->items[item]; - engine->shape( item ); - advance_t *advances = engine->advances( si ); - unsigned short *logClusters = engine->logClusters( si ); - - int l = engine->length( item ); - bool reverse = si->analysis.bidiLevel % 2; - if ( x < 0 ) - return reverse ? l : 0; - - - if ( reverse ) { - int width = 0; - for ( int i = 0; i < si->num_glyphs; i++ ) { - width += advances[i]; - } - x = -x + width; - } - int cp_before = 0; - int cp_after = 0; - int x_before = 0; - int x_after = 0; - - int lastCluster = 0; - for ( int i = 1; i <= l; i++ ) { - int newCluster = i < l ? logClusters[i] : si->num_glyphs; - if ( newCluster != lastCluster ) { - // calculate cluster width - cp_before = cp_after; - x_before = x_after; - cp_after = i; - for ( int j = lastCluster; j < newCluster; j++ ) - x_after += advances[j]; - // tqDebug("cluster boundary: lastCluster=%d, newCluster=%d, x_before=%d, x_after=%d", - // lastCluster, newCluster, x_before, x_after ); - if ( x_after > x ) - break; - lastCluster = newCluster; - } - } - - bool before = ( cpos == OnCharacters || (x - x_before) < (x_after - x) ); - -// tqDebug("got cursor position for %d: %d/%d, x_ba=%d/%d using %d", -// x, cp_before,cp_after, x_before, x_after, before ? cp_before : cp_after ); - - return before ? cp_before : cp_after; - -} - - -bool TQTextItem::isRightToLeft() const -{ - return (engine->items[item].analysis.bidiLevel % 2); -} - -bool TQTextItem::isObject() const -{ - return engine->items[item].isObject; -} - -bool TQTextItem::isSpace() const -{ - return engine->items[item].isSpace; -} - -bool TQTextItem::isTab() const -{ - return engine->items[item].isTab; -} - - -TQTextLayout::TQTextLayout() - :d(0) {} - -TQTextLayout::TQTextLayout( const TQString& string, TQPainter *p ) -{ - TQFontPrivate *f = p ? ( p->pfont ? p->pfont->d : p->cfont.d ) : TQApplication::font().d; - d = new TQTextEngine( (string.isNull() ? (const TQString&)TQString::fromLatin1("") : string), f ); -} - -TQTextLayout::TQTextLayout( const TQString& string, const TQFont& fnt ) -{ - d = new TQTextEngine( (string.isNull() ? (const TQString&)TQString::fromLatin1("") : string), fnt.d ); -} - -TQTextLayout::~TQTextLayout() -{ - delete d; -} - -void TQTextLayout::setText( const TQString& string, const TQFont& fnt ) -{ - delete d; - d = new TQTextEngine( (string.isNull() ? (const TQString&)TQString::fromLatin1("") : string), fnt.d ); -} - -/* add an additional item boundary eg. for style change */ -void TQTextLayout::setBoundary( int strPos ) -{ - if ( strPos <= 0 || strPos >= (int)d->string.length() ) - return; - - int itemToSplit = 0; - while ( itemToSplit < d->items.size() && d->items[itemToSplit].position <= strPos ) - itemToSplit++; - itemToSplit--; - if ( d->items[itemToSplit].position == strPos ) { - // already a split at the requested position - return; - } - d->splitItem( itemToSplit, strPos - d->items[itemToSplit].position ); -} - - -int TQTextLayout::numItems() const -{ - return d->items.size(); -} - -TQTextItem TQTextLayout::itemAt( int i ) const -{ - return TQTextItem( i, d ); -} - - -TQTextItem TQTextLayout::findItem( int strPos ) const -{ - if ( strPos == 0 && d->items.size() ) - return TQTextItem( 0, d ); - // ## TODO use bsearch - for ( int i = d->items.size()-1; i >= 0; --i ) { - if ( d->items[i].position < strPos ) - return TQTextItem( i, d ); - } - return TQTextItem(); -} - - -void TQTextLayout::beginLayout( TQTextLayout::LayoutMode m ) -{ - d->items.clear(); - TQTextEngine::Mode mode = TQTextEngine::Full; - if (m == NoBidi) - mode = TQTextEngine::NoBidi; - else if (m == SingleLine) - mode = TQTextEngine::SingleLine; - d->itemize( mode ); - d->currentItem = 0; - d->firstItemInLine = -1; -} - -void TQTextLayout::beginLine( int width ) -{ - d->lineWidth = width; - d->widthUsed = 0; - d->firstItemInLine = -1; -} - -bool TQTextLayout::atEnd() const -{ - return d->currentItem >= d->items.size(); -} - -TQTextItem TQTextLayout::nextItem() -{ - d->currentItem++; - - if ( d->currentItem >= d->items.size() ) - return TQTextItem(); - - d->shape( d->currentItem ); - return TQTextItem( d->currentItem, d ); -} - -TQTextItem TQTextLayout::currentItem() -{ - if ( d->currentItem >= d->items.size() ) - return TQTextItem(); - - d->shape( d->currentItem ); - return TQTextItem( d->currentItem, d ); -} - -/* ## maybe also currentItem() */ -void TQTextLayout::setLineWidth( int newWidth ) -{ - d->lineWidth = newWidth; -} - -int TQTextLayout::lineWidth() const -{ - return d->lineWidth; -} - -int TQTextLayout::widthUsed() const -{ - return d->widthUsed; -} - -int TQTextLayout::availableWidth() const -{ - return d->lineWidth - d->widthUsed; -} - - -/* returns true if completely added */ -TQTextLayout::Result TQTextLayout::addCurrentItem() -{ - if ( d->firstItemInLine == -1 ) - d->firstItemInLine = d->currentItem; - TQScriptItem ¤t = d->items[d->currentItem]; - d->shape( d->currentItem ); - d->widthUsed += current.width; -// tqDebug("trying to add item %d with width %d, remaining %d", d->currentItem, current.width, d->lineWidth-d->widthUsed ); - - d->currentItem++; - - return (d->widthUsed <= d->lineWidth - || (d->currentItem < d->items.size() && d->items[d->currentItem].isSpace)) ? Ok : LineFull; -} - -TQTextLayout::Result TQTextLayout::endLine( int x, int y, int alignment, - int *ascent, int *descent, int *lineLeft, int *lineRight ) -{ - int available = d->lineWidth; - int numRuns = 0; - int numSpaceItems = 0; - TQ_UINT8 _levels[128]; - int _visual[128]; - TQ_UINT8 *levels = _levels; - int *visual = _visual; - int i; - TQTextLayout::Result result = LineEmpty; - -// tqDebug("endLine x=%d, y=%d, first=%d, current=%d lw=%d wu=%d", x, y, d->firstItemInLine, d->currentItem, d->lineWidth, d->widthUsed ); - int width_nobreak_found = d->widthUsed; - if ( d->firstItemInLine == -1 ) - goto end; - - if ( !(alignment & (TQt::SingleLine|TQt::IncludeTrailingSpaces)) - && d->currentItem > d->firstItemInLine && d->items[d->currentItem-1].isSpace ) { - int i = d->currentItem-1; - while ( i > d->firstItemInLine && d->items[i].isSpace ) { - numSpaceItems++; - d->widthUsed -= d->items[i--].width; - } - } - - if ( (alignment & (TQt::WordBreak|TQt::BreakAnywhere)) && - d->widthUsed > d->lineWidth ) { - // find linebreak - - // even though we removed trailing spaces the line was too wide. We'll have to break at an earlier - // position. To not confuse the layouting below, reset the number of space items - numSpaceItems = 0; - - - bool breakany = alignment & TQt::BreakAnywhere; - - const TQCharAttributes *attrs = d->attributes(); - int w = 0; - int itemWidth = 0; - int breakItem = d->firstItemInLine; - int breakPosition = -1; -#if 0 - // we iterate backwards or forward depending on what we guess is closer - if ( d->widthUsed - d->lineWidth < d->lineWidth ) { - // backwards search should be faster - - } else -#endif - { - int tmpWidth = 0; - int swidth = 0; - // forward search is probably faster - for ( int i = d->firstItemInLine; i < d->currentItem; i++ ) { - const TQScriptItem *si = &d->items[i]; - int length = d->length( i ); - const TQCharAttributes *itemAttrs = attrs + si->position; - - advance_t *advances = d->advances( si ); - unsigned short *logClusters = d->logClusters( si ); - - int lastGlyph = 0; - int tmpItemWidth = 0; - -// tqDebug("looking for break in item %d, isSpace=%d", i, si->isSpace ); - if(si->isSpace && !(alignment & (TQt::SingleLine|TQt::IncludeTrailingSpaces))) { - swidth += si->width; - } else { - tmpWidth += swidth; - swidth = 0; - for ( int pos = 0; pos < length; pos++ ) { -// tqDebug("advance=%d, w=%d, tmpWidth=%d, softbreak=%d, whitespace=%d", -// *advances, w, tmpWidth, itemAttrs->softBreak, itemAttrs->whiteSpace ); - int glyph = logClusters[pos]; - if ( lastGlyph != glyph ) { - while ( lastGlyph < glyph ) - tmpItemWidth += advances[lastGlyph++]; - if ( breakPosition != -1 && w + tmpWidth + tmpItemWidth > d->lineWidth ) { -// tqDebug("found break at w=%d, tmpWidth=%d, tmpItemWidth=%d", w, tmpWidth, tmpItemWidth); - d->widthUsed = w; - goto found; - } - } - if ( (itemAttrs->softBreak || - ( breakany && itemAttrs->charStop ) ) && - (i != d->firstItemInLine || pos != 0) ) { - if ( breakItem != i ) - itemWidth = 0; - if (itemAttrs->softBreak) - breakany = FALSE; - breakItem = i; - breakPosition = pos; -// tqDebug("found possible break at item %d, position %d (absolute=%d), w=%d, tmpWidth=%d, tmpItemWidth=%d", breakItem, breakPosition, d->items[breakItem].position+breakPosition, w, tmpWidth, tmpItemWidth); - w += tmpWidth + tmpItemWidth; - itemWidth += tmpItemWidth; - tmpWidth = 0; - tmpItemWidth = 0; - } - itemAttrs++; - } - while ( lastGlyph < si->num_glyphs ) - tmpItemWidth += advances[lastGlyph++]; - tmpWidth += tmpItemWidth; - if ( w + tmpWidth > d->lineWidth ) { - d->widthUsed = w; - goto found; - } - } - } - } - - found: - // no valid break point found - if ( breakPosition == -1 ) { - d->widthUsed = width_nobreak_found; - goto nobreak; - } - -// tqDebug("linebreak at item %d, position %d, wu=%d", breakItem, breakPosition, d->widthUsed ); - // split the line - if ( breakPosition > 0 ) { -// int length = d->length( breakItem ); - -// tqDebug("splitting item, itemWidth=%d", itemWidth); - // not a full item, need to break - d->splitItem( breakItem, breakPosition ); - d->currentItem = breakItem+1; - } else { - d->currentItem = breakItem; - } - } - - result = Ok; - - nobreak: - // position the objects in the line - available -= d->widthUsed; - - numRuns = d->currentItem - d->firstItemInLine - numSpaceItems; - if ( numRuns > 127 ) { - levels = new TQ_UINT8[numRuns]; - visual = new int[numRuns]; - } - -// tqDebug("reordering %d runs, numSpaceItems=%d", numRuns, numSpaceItems ); - for ( i = 0; i < numRuns; i++ ) { - levels[i] = d->items[i+d->firstItemInLine].analysis.bidiLevel; -// tqDebug(" level = %d", d->items[i+d->firstItemInLine].analysis.bidiLevel ); - } - d->bidiReorder( numRuns, levels, visual ); - - end: - // ### FIXME - if ( alignment & TQt::AlignJustify ) { - // #### justify items - alignment = TQt::AlignAuto; - } - if ( (alignment & TQt::AlignHorizontal_Mask) == TQt::AlignAuto ) - alignment = TQt::AlignLeft; - if ( alignment & TQt::AlignRight ) - x += available; - else if ( alignment & TQt::AlignHCenter ) - x += available/2; - - - int asc = ascent ? *ascent : 0; - int desc = descent ? *descent : 0; - - for ( i = 0; i < numRuns; i++ ) { - TQScriptItem &si = d->items[d->firstItemInLine+visual[i]]; - asc = TQMAX( asc, si.ascent ); - desc = TQMAX( desc, si.descent ); - } - - int left = x; - for ( i = 0; i < numRuns; i++ ) { - TQScriptItem &si = d->items[d->firstItemInLine+visual[i]]; -// tqDebug("positioning item %d with width %d (from=%d/length=%d) at %d", d->firstItemInLine+visual[i], si.width, si.position, -// d->length(d->firstItemInLine+visual[i]), x ); - si.x = x; - si.y = y + asc; - x += si.width; - } - int right = x; - - if ( numSpaceItems ) { - if ( d->items[d->firstItemInLine+numRuns].analysis.bidiLevel % 2 ) { - x = left; - for ( i = 0; i < numSpaceItems; i++ ) { - TQScriptItem &si = d->items[d->firstItemInLine + numRuns + i]; - x -= si.width; - si.x = x; - si.y = y + asc; - } - } else { - for ( i = 0; i < numSpaceItems; i++ ) { - TQScriptItem &si = d->items[d->firstItemInLine + numRuns + i]; - si.x = x; - si.y = y + asc; - x += si.width; - } - } - } - - if ( lineLeft ) - *lineLeft = left; - if ( lineRight ) - *lineRight = right; - if ( ascent ) - *ascent = asc; - if ( descent ) - *descent = desc; - - if (levels != _levels) - delete []levels; - if (visual != _visual) - delete []visual; - - return result; -} - -void TQTextLayout::endLayout() -{ - // nothing to do currently -} - - -int TQTextLayout::nextCursorPosition( int oldPos, CursorMode mode ) const -{ -// tqDebug("looking for next cursor pos for %d", oldPos ); - const TQCharAttributes *attributes = d->attributes(); - int len = d->string.length(); - if ( oldPos >= len ) - return oldPos; - oldPos++; - if ( mode == SkipCharacters ) { - while ( oldPos < len && !attributes[oldPos].charStop ) - oldPos++; - } else { - while ( oldPos < len && !attributes[oldPos].wordStop && !attributes[oldPos-1].whiteSpace ) - oldPos++; - } -// tqDebug(" -> %d", oldPos ); - return oldPos; -} - -int TQTextLayout::previousCursorPosition( int oldPos, CursorMode mode ) const -{ -// tqDebug("looking for previous cursor pos for %d", oldPos ); - const TQCharAttributes *attributes = d->attributes(); - if ( oldPos <= 0 ) - return 0; - oldPos--; - if ( mode == SkipCharacters ) { - while ( oldPos && !attributes[oldPos].charStop ) - oldPos--; - } else { - while ( oldPos && !attributes[oldPos].wordStop && !attributes[oldPos-1].whiteSpace ) - oldPos--; - } -// tqDebug(" -> %d", oldPos ); - return oldPos; -} - - -bool TQTextLayout::validCursorPosition( int pos ) const -{ - const TQCharAttributes *attributes = d->attributes(); - if ( pos < 0 || pos > (int)d->string.length() ) - return FALSE; - return attributes[pos].charStop; -} - -void TQTextLayout::setDirection(TQChar::Direction dir) -{ - d->direction = dir; -} diff --git a/src/kernel/qtextlayout_p.h b/src/kernel/qtextlayout_p.h deleted file mode 100644 index 64c7f64d..00000000 --- a/src/kernel/qtextlayout_p.h +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** -** ??? -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** Licensees holding valid TQt Commercial licenses may use this file in -** accordance with the TQt Commercial License Agreement provided with -** the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTLAYOUT_P_H -#define TQTEXTLAYOUT_P_H - -#ifndef QT_H -#include "tqstring.h" -#include "ntqnamespace.h" -#include "ntqrect.h" -#endif // QT_H - -class TQTextEngine; -class TQFont; - -class TQ_EXPORT TQTextItem -{ -public: - inline TQTextItem() : item(0), engine(0) {} - inline bool isValid() const { return (bool)engine; } - - TQRect rect() const; - int x() const; - int y() const; - int width() const; - int ascent() const; - int descent() const; - - enum Edge { - Leading, - Trailing - }; - enum CursorPosition { - BetweenCharacters, - OnCharacters - }; - - /* cPos gets set to the valid position */ - int cursorToX( int *cPos, Edge edge = Leading ) const; - inline int cursorToX( int cPos, Edge edge = Leading ) const { return cursorToX( &cPos, edge ); } - int xToCursor( int x, CursorPosition = BetweenCharacters ) const; - - bool isRightToLeft() const; - bool isObject() const; - bool isSpace() const; - bool isTab() const; - - void setWidth( int w ); - void setAscent( int a ); - void setDescent( int d ); - - int from() const; - int length() const; - -private: - friend class TQTextLayout; - friend class TQPainter; - friend class TQPSPrinter; - TQTextItem( int i, TQTextEngine *e ) : item( i ), engine( e ) {} - int item; - TQTextEngine *engine; -}; - - -class TQPainter; - -class TQ_EXPORT TQTextLayout -{ -public: - // does itemization - TQTextLayout(); - TQTextLayout( const TQString& string, TQPainter * = 0 ); - TQTextLayout( const TQString& string, const TQFont& fnt ); - ~TQTextLayout(); - - void setText( const TQString& string, const TQFont& fnt ); - - enum LineBreakStrategy { - AtWordBoundaries, - AtCharBoundaries - }; - - /* add an additional item boundary eg. for style change */ - void setBoundary( int strPos ); - - int numItems() const; - TQTextItem itemAt( int i ) const; - TQTextItem findItem( int strPos ) const; - - enum LayoutMode { - NoBidi, - SingleLine, - MultiLine - }; - void beginLayout( LayoutMode m = MultiLine ); - void beginLine( int width ); - - bool atEnd() const; - TQTextItem nextItem(); - TQTextItem currentItem(); - /* ## maybe also currentItem() */ - void setLineWidth( int newWidth ); - int lineWidth() const; - int widthUsed() const; - int availableWidth() const; - - enum Result { - Ok, - LineFull, - LineEmpty, - Error - }; - /* returns true if completely added */ - Result addCurrentItem(); - - /* Note: if ascent and descent are used they must be initialized to the minimum ascent/descent - acceptable for the line. TQFontMetrics::ascent/descent() is usually the right choice */ - Result endLine( int x = 0, int y = 0, int alignment = TQt::AlignLeft, - int *ascent = 0, int *descent = 0, int *left = 0, int *right = 0 ); - void endLayout(); - - enum CursorMode { - SkipCharacters, - SkipWords - }; - bool validCursorPosition( int pos ) const; - int nextCursorPosition( int oldPos, CursorMode mode = SkipCharacters ) const; - int previousCursorPosition( int oldPos, CursorMode mode = SkipCharacters ) const; - - void setDirection(TQChar::Direction); -private: - TQTextLayout( TQTextEngine *e ) : d( e ) {} - /* disable copy and assignment */ - TQTextLayout( const TQTextLayout & ) {} - void operator = ( const TQTextLayout & ) {} - - friend class TQTextItem; - friend class TQPainter; - friend class TQPSPrinter; - TQTextEngine *d; -}; - - -/* - class TQPainter { - ..... - void drawTextItem( int x, int y, TQTextItem *item ); - }; -*/ - -#endif diff --git a/src/kernel/tqimage.cpp b/src/kernel/tqimage.cpp index 7a454818..d31168c7 100644 --- a/src/kernel/tqimage.cpp +++ b/src/kernel/tqimage.cpp @@ -42,7 +42,7 @@ #include "ntqregexp.h" #include "ntqfile.h" #include "ntqdatastream.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqbuffer.h" #include "tqptrlist.h" #include "ntqasyncimageio.h" diff --git a/src/kernel/tqtextengine.cpp b/src/kernel/tqtextengine.cpp new file mode 100644 index 00000000..b66fb7d9 --- /dev/null +++ b/src/kernel/tqtextengine.cpp @@ -0,0 +1,1180 @@ +/**************************************************************************** +** +** Text engine classes +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextengine_p.h" + +#include "qscriptengine_p.h" +#include <ntqfont.h> +#include "qfontdata_p.h" +#include "qfontengine_p.h" +#include <tqstring.h> +#include <private/qunicodetables_p.h> +#include <stdlib.h> + +// ----------------------------------------------------------------------------------------------------- +// +// The BiDi algorithm +// +// ----------------------------------------------------------------------------------------------------- + + +#define BIDI_DEBUG 0//2 +#if (BIDI_DEBUG >= 1) +#include <iostream> +using namespace std; + +static const char *directions[] = { + "DirL", "DirR", "DirEN", "DirES", "DirET", "DirAN", "DirCS", "DirB", "DirS", "DirWS", "DirON", + "DirLRE", "DirLRO", "DirAL", "DirRLE", "DirRLO", "DirPDF", "DirNSM", "DirBN" +}; + +#endif + +struct BidiStatus { + BidiStatus() { + eor = TQChar::DirON; + lastStrong = TQChar::DirON; + last = TQChar:: DirON; + dir = TQChar::DirON; + } + TQChar::Direction eor; + TQChar::Direction lastStrong; + TQChar::Direction last; + TQChar::Direction dir; +}; + +struct BidiControl { + struct Context { + unsigned char level : 6; + unsigned char override : 1; + unsigned char unused : 1; + }; + + inline BidiControl( bool rtl ) + : cCtx( 0 ), singleLine( FALSE ) { + ctx[0].level = (rtl ? 1 : 0); + ctx[0].override = FALSE; + } + + inline void embed( int level, bool override = FALSE ) { + if ( ctx[cCtx].level < 61 && cCtx < 61 ) { + (void) ++cCtx; + ctx[cCtx].level = level; + ctx[cCtx].override = override; + } + } + inline void pdf() { + if ( cCtx ) (void) --cCtx; + } + + inline uchar level() const { + return ctx[cCtx].level; + } + inline bool override() const { + return ctx[cCtx].override; + } + inline TQChar::Direction basicDirection() { + return (ctx[0].level ? TQChar::DirR : TQChar:: DirL ); + } + inline uchar baseLevel() { + return ctx[0].level; + } + inline TQChar::Direction direction() { + return ((ctx[cCtx].level%2) ? TQChar::DirR : TQChar:: DirL ); + } + + Context ctx[63]; + unsigned int cCtx : 8; + bool singleLine : 8; +}; + +static TQChar::Direction basicDirection( const TQString &str ) +{ + int len = str.length(); + int pos = 0; + const TQChar *uc = str.unicode() + pos; + while( pos < len ) { + switch( direction( *uc ) ) + { + case TQChar::DirL: + case TQChar::DirLRO: + case TQChar::DirLRE: + return TQChar::DirL; + case TQChar::DirR: + case TQChar::DirAL: + case TQChar::DirRLO: + case TQChar::DirRLE: + return TQChar::DirR; + default: + break; + } + ++pos; + ++uc; + } + return TQChar::DirL; +} + + +static void tqAppendItems(TQTextEngine *engine, int &start, int &stop, BidiControl &control, TQChar::Direction dir ) +{ + TQScriptItemArray &items = engine->items; + const TQChar *text = engine->string.unicode(); + + if ( start > stop ) { + // #### the algorithm is currently not really safe against this. Still needs fixing. +// tqWarning( "Bidi: appendItems() internal error" ); + return; + } + + int level = control.level(); + + if(dir != TQChar::DirON && !control.override()) { + // add level of run (cases I1 & I2) + if( level % 2 ) { + if(dir == TQChar::DirL || dir == TQChar::DirAN || dir == TQChar::DirEN ) + level++; + } else { + if( dir == TQChar::DirR ) + level++; + else if( dir == TQChar::DirAN || dir == TQChar::DirEN ) + level += 2; + } + } + +#if (BIDI_DEBUG >= 1) + tqDebug("new run: dir=%s from %d, to %d level = %d\n", directions[dir], start, stop, level); +#endif + TQFont::Script script = TQFont::NoScript; + TQScriptItem item; + item.position = start; + item.analysis.script = script; + item.analysis.bidiLevel = level; + item.analysis.override = control.override(); + item.analysis.reserved = 0; + + if ( control.singleLine ) { + for ( int i = start; i <= stop; i++ ) { + + unsigned short uc = text[i].unicode(); + TQFont::Script s = (TQFont::Script)scriptForChar( uc ); + if (s == TQFont::UnknownScript || s == TQFont::CombiningMarks) + s = script; + + if (s != script) { + item.analysis.script = s; + item.analysis.bidiLevel = level; + item.position = i; + items.append( item ); + script = s; + } + } + } else { + for ( int i = start; i <= stop; i++ ) { + + unsigned short uc = text[i].unicode(); + TQFont::Script s = (TQFont::Script)scriptForChar( uc ); + if (s == TQFont::UnknownScript || s == TQFont::CombiningMarks) + s = script; + + TQChar::Category category = ::category( uc ); + if ( uc == 0xfffcU || uc == 0x2028U ) { + item.analysis.bidiLevel = level % 2 ? level-1 : level; + item.analysis.script = TQFont::Latin; + item.isObject = TRUE; + s = TQFont::NoScript; + } else if ((uc >= 9 && uc <=13) || + (category >= TQChar::Separator_Space && category <= TQChar::Separator_Paragraph)) { + item.analysis.script = TQFont::Latin; + item.isSpace = TRUE; + item.isTab = ( uc == '\t' ); + item.analysis.bidiLevel = item.isTab ? control.baseLevel() : level; + s = TQFont::NoScript; + } else if ( s != script && (category != TQChar::Mark_NonSpacing || script == TQFont::NoScript)) { + item.analysis.script = s; + item.analysis.bidiLevel = level; + } else { + if (i - start < 32000) + continue; + start = i; + } + + item.position = i; + items.append( item ); + script = s; + item.isSpace = item.isTab = item.isObject = FALSE; + } + } + ++stop; + start = stop; +} + +typedef void (* fAppendItems)(TQTextEngine *, int &start, int &stop, BidiControl &control, TQChar::Direction dir); +static fAppendItems appendItems = tqAppendItems; + +// creates the next TQScript items. +static void bidiItemize( TQTextEngine *engine, bool rightToLeft, int mode ) +{ + BidiControl control( rightToLeft ); + if ( mode & TQTextEngine::SingleLine ) + control.singleLine = TRUE; + + int sor = 0; + int eor = -1; + + // ### should get rid of this! + bool first = TRUE; + + int length = engine->string.length(); + + if ( !length ) + return; + + const TQChar *unicode = engine->string.unicode(); + int current = 0; + + TQChar::Direction dir = rightToLeft ? TQChar::DirR : TQChar::DirL; + BidiStatus status; + TQChar::Direction sdir = direction( *unicode ); + if ( sdir != TQChar::DirL && sdir != TQChar::DirR && sdir != TQChar::DirAL && sdir != TQChar::DirEN && sdir != TQChar::DirAN ) + sdir = TQChar::DirON; + else + dir = TQChar::DirON; + status.eor = sdir; + status.lastStrong = rightToLeft ? TQChar::DirR : TQChar::DirL; + status.last = status.lastStrong; + status.dir = sdir; +#if (BIDI_DEBUG >= 2) + tqDebug("---- bidiReorder --- '%s'", engine->string.utf8().data()); + tqDebug("rightToLeft = %d", rightToLeft); +#endif + + + while ( current <= length ) { + + TQChar::Direction dirCurrent; + if ( current == (int)length ) + dirCurrent = control.basicDirection(); + else + dirCurrent = direction( unicode[current] ); + +#if (BIDI_DEBUG >= 2) + cout << "pos=" << current << " dir=" << directions[dir] + << " current=" << directions[dirCurrent] << " last=" << directions[status.last] + << " eor=" << eor << "/" << directions[status.eor] + << " sor=" << sor << " lastStrong=" + << directions[status.lastStrong] + << " level=" << (int)control.level() << endl; +#endif + + switch(dirCurrent) { + + // embedding and overrides (X1-X9 in the BiDi specs) + case TQChar::DirRLE: + case TQChar::DirRLO: + case TQChar::DirLRE: + case TQChar::DirLRO: + { + bool rtl = (dirCurrent == TQChar::DirRLE || dirCurrent == TQChar::DirRLO ); + bool override = (dirCurrent == TQChar::DirLRO || dirCurrent == TQChar::DirRLO ); + + uchar level = control.level(); + if( (level%2 != 0) == rtl ) + level += 2; + else + level++; + if(level < 61) { + eor = current-1; + appendItems(engine, sor, eor, control, dir); + eor = current; + control.embed( level, override ); + TQChar::Direction edir = (rtl ? TQChar::DirR : TQChar::DirL ); + dir = status.eor = edir; + status.lastStrong = edir; + } + break; + } + case TQChar::DirPDF: + { + if (dir != control.direction()) { + eor = current-1; + appendItems(engine, sor, eor, control, dir); + dir = control.direction(); + } + eor = current; + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirON; + status.last = control.direction(); + control.pdf(); + if ( control.override() ) + dir = control.direction(); + else + dir = TQChar::DirON; + status.lastStrong = control.direction(); + break; + } + + // strong types + case TQChar::DirL: + if(dir == TQChar::DirON) + dir = TQChar::DirL; + switch(status.last) + { + case TQChar::DirL: + eor = current; status.eor = TQChar::DirL; break; + case TQChar::DirR: + case TQChar::DirAL: + case TQChar::DirEN: + case TQChar::DirAN: + if ( !first ) { + appendItems(engine, sor, eor, control, dir); + dir = eor < length ? direction( unicode[eor] ) : control.basicDirection(); + status.eor = dir; + } else { + eor = current; status.eor = dir; + } + break; + case TQChar::DirES: + case TQChar::DirET: + case TQChar::DirCS: + case TQChar::DirBN: + case TQChar::DirB: + case TQChar::DirS: + case TQChar::DirWS: + case TQChar::DirON: + if(dir != TQChar::DirL) { + //last stuff takes embedding dir + if( control.direction() == TQChar::DirR ) { + if(status.eor != TQChar::DirR) { + // AN or EN + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirON; + dir = TQChar::DirR; + } + eor = current - 1; + appendItems(engine, sor, eor, control, dir); + dir = eor < length ? direction( unicode[eor] ) : control.basicDirection(); + status.eor = dir; + } else { + if(status.eor != TQChar::DirL) { + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirON; + dir = TQChar::DirL; + } else { + eor = current; status.eor = TQChar::DirL; break; + } + } + } else { + eor = current; status.eor = TQChar::DirL; + } + default: + break; + } + status.lastStrong = TQChar::DirL; + break; + case TQChar::DirAL: + case TQChar::DirR: + if(dir == TQChar::DirON) dir = TQChar::DirR; + switch(status.last) + { + case TQChar::DirL: + case TQChar::DirEN: + case TQChar::DirAN: + if ( !first ) { + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirON; + break; + } + case TQChar::DirR: + case TQChar::DirAL: + eor = current; status.eor = TQChar::DirR; break; + case TQChar::DirES: + case TQChar::DirET: + case TQChar::DirCS: + case TQChar::DirBN: + case TQChar::DirB: + case TQChar::DirS: + case TQChar::DirWS: + case TQChar::DirON: + if( status.eor != TQChar::DirR && status.eor != TQChar::DirAL ) { + //last stuff takes embedding dir + if(control.direction() == TQChar::DirR + || status.lastStrong == TQChar::DirR || status.lastStrong == TQChar::DirAL) { + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirON; + dir = TQChar::DirR; + eor = current; + } else { + eor = current - 1; + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirON; + dir = TQChar::DirR; + } + } else { + eor = current; status.eor = TQChar::DirR; + } + default: + break; + } + status.lastStrong = dirCurrent; + break; + + // weak types: + + case TQChar::DirNSM: + if (eor == current-1) + eor = current; + break; + case TQChar::DirEN: + // if last strong was AL change EN to AN + if(status.lastStrong != TQChar::DirAL) { + if(dir == TQChar::DirON) { + if(status.lastStrong == TQChar::DirL) + dir = TQChar::DirL; + else + dir = TQChar::DirEN; + } + switch(status.last) + { + case TQChar::DirET: + if ( status.lastStrong == TQChar::DirR || status.lastStrong == TQChar::DirAL ) { + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirON; + dir = TQChar::DirAN; + } + // fall through + case TQChar::DirEN: + case TQChar::DirL: + eor = current; + status.eor = dirCurrent; + break; + case TQChar::DirR: + case TQChar::DirAL: + case TQChar::DirAN: + if ( !first ) + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirEN; + dir = TQChar::DirAN; break; + case TQChar::DirES: + case TQChar::DirCS: + if(status.eor == TQChar::DirEN || dir == TQChar::DirAN) { + eor = current; break; + } + case TQChar::DirBN: + case TQChar::DirB: + case TQChar::DirS: + case TQChar::DirWS: + case TQChar::DirON: + if(status.eor == TQChar::DirR) { + // neutrals go to R + eor = current - 1; + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirEN; + dir = TQChar::DirAN; + } + else if( status.eor == TQChar::DirL || + (status.eor == TQChar::DirEN && status.lastStrong == TQChar::DirL)) { + eor = current; status.eor = dirCurrent; + } else { + // numbers on both sides, neutrals get right to left direction + if(dir != TQChar::DirL) { + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirON; + eor = current - 1; + dir = TQChar::DirR; + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirON; + dir = TQChar::DirAN; + } else { + eor = current; status.eor = dirCurrent; + } + } + default: + break; + } + break; + } + case TQChar::DirAN: + dirCurrent = TQChar::DirAN; + if(dir == TQChar::DirON) dir = TQChar::DirAN; + switch(status.last) + { + case TQChar::DirL: + case TQChar::DirAN: + eor = current; status.eor = TQChar::DirAN; break; + case TQChar::DirR: + case TQChar::DirAL: + case TQChar::DirEN: + if ( !first ) + appendItems(engine, sor, eor, control, dir); + dir = TQChar::DirON; status.eor = TQChar::DirAN; + break; + case TQChar::DirCS: + if(status.eor == TQChar::DirAN) { + eor = current; break; + } + case TQChar::DirES: + case TQChar::DirET: + case TQChar::DirBN: + case TQChar::DirB: + case TQChar::DirS: + case TQChar::DirWS: + case TQChar::DirON: + if(status.eor == TQChar::DirR) { + // neutrals go to R + eor = current - 1; + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirAN; + dir = TQChar::DirAN; + } else if( status.eor == TQChar::DirL || + (status.eor == TQChar::DirEN && status.lastStrong == TQChar::DirL)) { + eor = current; status.eor = dirCurrent; + } else { + // numbers on both sides, neutrals get right to left direction + if(dir != TQChar::DirL) { + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirON; + eor = current - 1; + dir = TQChar::DirR; + appendItems(engine, sor, eor, control, dir); + status.eor = TQChar::DirAN; + dir = TQChar::DirAN; + } else { + eor = current; status.eor = dirCurrent; + } + } + default: + break; + } + break; + case TQChar::DirES: + case TQChar::DirCS: + break; + case TQChar::DirET: + if(status.last == TQChar::DirEN) { + dirCurrent = TQChar::DirEN; + eor = current; status.eor = dirCurrent; + } + break; + + // boundary neutrals should be ignored + case TQChar::DirBN: + break; + // neutrals + case TQChar::DirB: + // ### what do we do with newline and paragraph separators that come to here? + break; + case TQChar::DirS: + // ### implement rule L1 + break; + case TQChar::DirWS: + case TQChar::DirON: + break; + default: + break; + } + + //cout << " after: dir=" << // dir << " current=" << dirCurrent << " last=" << status.last << " eor=" << status.eor << " lastStrong=" << status.lastStrong << " embedding=" << control.direction() << endl; + + if(current >= (int)length) break; + + // set status.last as needed. + switch(dirCurrent) { + case TQChar::DirET: + case TQChar::DirES: + case TQChar::DirCS: + case TQChar::DirS: + case TQChar::DirWS: + case TQChar::DirON: + switch(status.last) + { + case TQChar::DirL: + case TQChar::DirR: + case TQChar::DirAL: + case TQChar::DirEN: + case TQChar::DirAN: + status.last = dirCurrent; + break; + default: + status.last = TQChar::DirON; + } + break; + case TQChar::DirNSM: + case TQChar::DirBN: + // ignore these + break; + case TQChar::DirLRO: + case TQChar::DirLRE: + status.last = TQChar::DirL; + break; + case TQChar::DirRLO: + case TQChar::DirRLE: + status.last = TQChar::DirR; + break; + case TQChar::DirEN: + if ( status.last == TQChar::DirL ) { + status.last = TQChar::DirL; + break; + } + // fall through + default: + status.last = dirCurrent; + } + + first = FALSE; + ++current; + } + +#if (BIDI_DEBUG >= 1) + cout << "reached end of line current=" << current << ", eor=" << eor << endl; +#endif + eor = current - 1; // remove dummy char + + if ( sor <= eor ) + appendItems(engine, sor, eor, control, dir); + + +} + +void TQTextEngine::bidiReorder( int numItems, const TQ_UINT8 *levels, int *visualOrder ) +{ + + // first find highest and lowest levels + uchar levelLow = 128; + uchar levelHigh = 0; + int i = 0; + while ( i < numItems ) { + //printf("level = %d\n", r->level); + if ( levels[i] > levelHigh ) + levelHigh = levels[i]; + if ( levels[i] < levelLow ) + levelLow = levels[i]; + i++; + } + + // implements reordering of the line (L2 according to BiDi spec): + // L2. From the highest level found in the text to the lowest odd level on each line, + // reverse any contiguous sequence of characters that are at that level or higher. + + // reversing is only done up to the lowest odd level + if(!(levelLow%2)) levelLow++; + +#if (BIDI_DEBUG >= 1) + cout << "reorderLine: lineLow = " << (uint)levelLow << ", lineHigh = " << (uint)levelHigh << endl; +#endif + + int count = numItems - 1; + for ( i = 0; i < numItems; i++ ) + visualOrder[i] = i; + + while(levelHigh >= levelLow) { + int i = 0; + while ( i < count ) { + while(i < count && levels[i] < levelHigh) i++; + int start = i; + while(i <= count && levels[i] >= levelHigh) i++; + int end = i-1; + + if(start != end) { + //cout << "reversing from " << start << " to " << end << endl; + for(int j = 0; j < (end-start+1)/2; j++) { + int tmp = visualOrder[start+j]; + visualOrder[start+j] = visualOrder[end-j]; + visualOrder[end-j] = tmp; + } + } + i++; + } + levelHigh--; + } + +#if (BIDI_DEBUG >= 1) + cout << "visual order is:" << endl; + for ( i = 0; i < numItems; i++ ) + cout << visualOrder[i] << endl; +#endif +} + + +// ----------------------------------------------------------------------------------------------------- +// +// The line break algorithm. See http://www.unicode.org/reports/tr14/tr14-13.html +// +// ----------------------------------------------------------------------------------------------------- + +/* The Unicode algorithm does in our opinion allow line breaks at some + places they shouldn't be allowed. The following changes were thus + made in comparison to the Unicode reference: + + CL->AL from Dbk to Ibk + CL->PR from Dbk to Ibk + EX->AL from Dbk to Ibk + IS->AL from Dbk to Ibk + PO->AL from Dbk to Ibk + SY->AL from Dbk to Ibk + SY->PO from Dbk to Ibk + SY->PR from Dbk to Ibk + SY->OP from Dbk to Ibk + Al->OP from Dbk to Ibk + AL->HY from Dbk to Ibk + AL->PR from Dbk to Ibk + AL->PO from Dbk to Ibk + PR->PR from Dbk to Ibk + PO->PO from Dbk to Ibk + PR->PO from Dbk to Ibk + PO->PR from Dbk to Ibk + HY->PO from Dbk to Ibk + HY->PR from Dbk to Ibk + HY->OP from Dbk to Ibk + PO->OP from Dbk to Ibk + NU->EX from Dbk to Ibk + NU->PR from Dbk to Ibk + PO->NU from Dbk to Ibk + EX->PO from Dbk to Ibk +*/ + +enum break_action { + Dbk, // Direct break + Ibk, // Indirect break; only allowed if space between the two chars + Pbk // Prohibited break; no break allowed even if space between chars +}; + +// The following line break classes are not treated by the table: +// SA, BK, CR, LF, SG, CB, SP +static const TQ_UINT8 breakTable[TQUnicodeTables::LineBreak_CM+1][TQUnicodeTables::LineBreak_CM+1] = +{ + // OP, CL, QU, GL, NS, EX, SY, IS, PR, PO, NU, AL, ID, IN, HY, BA, BB, B2, ZW, CM + { Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk, Pbk }, // OP + { Dbk, Pbk, Ibk, Pbk, Pbk, Pbk, Pbk, Pbk, Ibk, Ibk, Dbk, Ibk, Dbk, Dbk, Ibk, Ibk, Pbk, Pbk, Pbk, Pbk }, // CL + { Pbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Pbk }, // QU + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Pbk }, // GL + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // NS + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // EX + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // SY + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // IS + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk }, // PR + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // PO + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk }, // NU + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk }, // AL + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Ibk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // ID + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // IN + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // HY + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Dbk, Pbk, Ibk }, // BA + { Ibk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Ibk, Pbk, Ibk }, // BB + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Ibk, Ibk, Dbk, Pbk, Pbk, Ibk }, // B2 + { Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Dbk, Pbk, Ibk }, // ZW + { Dbk, Pbk, Ibk, Pbk, Ibk, Pbk, Pbk, Pbk, Dbk, Ibk, Dbk, Dbk, Dbk, Ibk, Ibk, Ibk, Dbk, Dbk, Pbk, Pbk } // CM +}; + +// set the soft break flag at every possible line breaking point. This needs correct clustering information. +static void calcLineBreaks(const TQString &str, TQCharAttributes *charAttributes) +{ + int len = str.length(); + if (!len) + return; + + const TQChar *uc = str.unicode(); + int cls = lineBreakClass(*uc); + if (cls >= TQUnicodeTables::LineBreak_CM) + cls = TQUnicodeTables::LineBreak_ID; + + charAttributes[0].softBreak = FALSE; + charAttributes[0].whiteSpace = (cls == TQUnicodeTables::LineBreak_SP); + charAttributes[0].charStop = TRUE; + + for (int i = 1; i < len; ++i) { + int ncls = ::lineBreakClass(uc[i]); + int category = ::category(uc[i]); + if (category == TQChar::Mark_NonSpacing) + goto nsm; + + if (category == TQChar::Other_Surrogate) { + // char stop only on first pair + if (uc[i].unicode() >= 0xd800 && uc[i].unicode() < 0xdc00 && i < len-1 + && uc[i+1].unicode() >= 0xdc00 && uc[i+1].unicode() < 0xe000) + goto nsm; + // ### correctly handle second surrogate + } + + if (ncls == TQUnicodeTables::LineBreak_SP) { + charAttributes[i].softBreak = FALSE; + charAttributes[i].whiteSpace = TRUE; + charAttributes[i].charStop = TRUE; + cls = ncls; + continue; + } + + + if (cls == TQUnicodeTables::LineBreak_SA && ncls == TQUnicodeTables::LineBreak_SA) { + // two complex chars (thai or lao), thai_attributes might override, but here + // we do a best guess + charAttributes[i].softBreak = TRUE; + charAttributes[i].whiteSpace = FALSE; + charAttributes[i].charStop = TRUE; + cls = ncls; + continue; + } + { + int tcls = ncls; + if (tcls >= TQUnicodeTables::LineBreak_SA) + tcls = TQUnicodeTables::LineBreak_ID; + if (cls >= TQUnicodeTables::LineBreak_SA) + cls = TQUnicodeTables::LineBreak_ID; + + bool softBreak; + int brk = breakTable[cls][tcls]; + if (brk == Ibk) + softBreak = (cls == TQUnicodeTables::LineBreak_SP); + else + softBreak = (brk == Dbk); +// tqDebug("char = %c %04x, cls=%d, ncls=%d, brk=%d soft=%d", uc[i].cell(), uc[i].unicode(), cls, ncls, brk, charAttributes[i].softBreak); + charAttributes[i].softBreak = softBreak; + charAttributes[i].whiteSpace = FALSE; + charAttributes[i].charStop = TRUE; + cls = ncls; + } + continue; + nsm: + charAttributes[i].softBreak = FALSE; + charAttributes[i].whiteSpace = FALSE; + charAttributes[i].charStop = FALSE; + } +} + +#if defined( TQ_WS_X11 ) || defined ( TQ_WS_QWS ) +# include "tqtextengine_unix.cpp" +#elif defined( TQ_WS_WIN ) +# include "tqtextengine_win.cpp" +#elif defined( TQ_WS_MAC ) +# include "tqtextengine_mac.cpp" +#endif + + + +TQTextEngine::TQTextEngine( const TQString &str, TQFontPrivate *f ) + : string( str ), fnt( f ), direction( TQChar::DirON ), haveCharAttributes( FALSE ), widthOnly( FALSE ) +{ +#ifdef TQ_WS_WIN + if ( !resolvedUsp10 ) + resolveUsp10(); +#endif + if ( fnt ) fnt->ref(); + + num_glyphs = TQMAX( 16, str.length()*3/2 ); + int space_charAttributes = (sizeof(TQCharAttributes)*str.length()+sizeof(void*)-1)/sizeof(void*); + int space_logClusters = (sizeof(unsigned short)*str.length()+sizeof(void*)-1)/sizeof(void*); + int space_glyphs = (sizeof(glyph_t)*num_glyphs+sizeof(void*)-1)/sizeof(void*); + int space_advances = (sizeof(advance_t)*num_glyphs+sizeof(void*)-1)/sizeof(void*); + int space_offsets = (sizeof(qoffset_t)*num_glyphs+sizeof(void*)-1)/sizeof(void*); + int space_glyphAttributes = (sizeof(GlyphAttributes)*num_glyphs+sizeof(void*)-1)/sizeof(void*); + + allocated = space_charAttributes + space_glyphs + space_advances + + space_offsets + space_logClusters + space_glyphAttributes; + memory = (void **)::malloc( allocated*sizeof( void * ) ); + memset( memory, 0, allocated*sizeof( void * ) ); + + void **m = memory; + m += space_charAttributes; + logClustersPtr = (unsigned short *) m; + m += space_logClusters; + glyphPtr = (glyph_t *) m; + m += space_glyphs; + advancePtr = (advance_t *) m; + m += space_advances; + offsetsPtr = (qoffset_t *) m; + m += space_offsets; + glyphAttributesPtr = (GlyphAttributes *) m; + + used = 0; +} + +TQTextEngine::~TQTextEngine() +{ + if ( fnt && fnt->deref()) + delete fnt; + free( memory ); + allocated = 0; +} + +void TQTextEngine::reallocate( int totalGlyphs ) +{ + int new_num_glyphs = totalGlyphs; + int space_charAttributes = (sizeof(TQCharAttributes)*string.length()+sizeof(void*)-1)/sizeof(void*); + int space_logClusters = (sizeof(unsigned short)*string.length()+sizeof(void*)-1)/sizeof(void*); + int space_glyphs = (sizeof(glyph_t)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); + int space_advances = (sizeof(advance_t)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); + int space_offsets = (sizeof(qoffset_t)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); + int space_glyphAttributes = (sizeof(GlyphAttributes)*new_num_glyphs+sizeof(void*)-1)/sizeof(void*); + + int newAllocated = space_charAttributes + space_glyphs + space_advances + + space_offsets + space_logClusters + space_glyphAttributes; + void ** newMemory = (void **)::malloc( newAllocated*sizeof( void * ) ); + + void **nm = newMemory; + memcpy( nm, memory, string.length()*sizeof(TQCharAttributes) ); + nm += space_charAttributes; + memcpy( nm, logClustersPtr, num_glyphs*sizeof(unsigned short) ); + logClustersPtr = (unsigned short *) nm; + nm += space_logClusters; + memcpy( nm, glyphPtr, num_glyphs*sizeof(glyph_t) ); + glyphPtr = (glyph_t *) nm; + nm += space_glyphs; + memcpy( nm, advancePtr, num_glyphs*sizeof(advance_t) ); + advancePtr = (advance_t *) nm; + nm += space_advances; + memcpy( nm, offsetsPtr, num_glyphs*sizeof(qoffset_t) ); + offsetsPtr = (qoffset_t *) nm; + nm += space_offsets; + memcpy( nm, glyphAttributesPtr, num_glyphs*sizeof(GlyphAttributes) ); + glyphAttributesPtr = (GlyphAttributes *) nm; + + free( memory ); + memory = newMemory; + allocated = newAllocated; + num_glyphs = new_num_glyphs; +} + +const TQCharAttributes *TQTextEngine::attributes() +{ + TQCharAttributes *charAttributes = (TQCharAttributes *) memory; + if ( haveCharAttributes ) + return charAttributes; + + if ( !items.d ) + itemize(); + + ensureSpace(string.length()); + charAttributes = (TQCharAttributes *) memory; + calcLineBreaks(string, charAttributes); + + for ( int i = 0; i < items.size(); i++ ) { + TQScriptItem &si = items[i]; +#ifdef TQ_WS_WIN + int script = uspScriptForItem(this, i); +#else + int script = si.analysis.script; +#endif + Q_ASSERT( script < TQFont::NScripts ); + AttributeFunction attributes = scriptEngines[script].charAttributes; + if (!attributes) + continue; + int from = si.position; + int len = length( i ); + attributes( script, string, from, len, charAttributes ); + } + + haveCharAttributes = TRUE; + return charAttributes; +} + +void TQTextEngine::splitItem( int item, int pos ) +{ + if ( pos <= 0 ) + return; + + // we have to ensure we get correct shaping for arabic and other + // complex languages so we have to call shape _before_ we split the item. + shape(item); + + if ( items.d->size == items.d->alloc ) + items.resize( items.d->size + 1 ); + + int numMove = items.d->size - item-1; + if ( numMove > 0 ) + memmove( items.d->items + item+2, items.d->items +item+1, numMove*sizeof( TQScriptItem ) ); + items.d->size++; + TQScriptItem &newItem = items.d->items[item+1]; + TQScriptItem &oldItem = items.d->items[item]; + newItem = oldItem; + items.d->items[item+1].position += pos; + if ( newItem.fontEngine ) + newItem.fontEngine->ref(); + + if (oldItem.num_glyphs) { + // already shaped, break glyphs aswell + int breakGlyph = logClusters(&oldItem)[pos]; + + newItem.num_glyphs = oldItem.num_glyphs - breakGlyph; + oldItem.num_glyphs = breakGlyph; + newItem.glyph_data_offset = oldItem.glyph_data_offset + breakGlyph; + + for (int i = 0; i < newItem.num_glyphs; i++) + logClusters(&newItem)[i] -= breakGlyph; + + int w = 0; + const advance_t *a = advances(&oldItem); + for(int j = 0; j < breakGlyph; ++j) + w += *(a++); + + newItem.width = oldItem.width - w; + oldItem.width = w; + } + +// tqDebug("split at position %d itempos=%d", pos, item ); +} + + +int TQTextEngine::width( int from, int len ) const +{ + int w = 0; + +// tqDebug("TQTextEngine::width( from = %d, len = %d ), numItems=%d, strleng=%d", from, len, items.size(), string.length() ); + for ( int i = 0; i < items.size(); i++ ) { + TQScriptItem *si = &items[i]; + int pos = si->position; + int ilen = length( i ); +// tqDebug("item %d: from %d len %d", i, pos, ilen ); + if ( pos >= from + len ) + break; + if ( pos + ilen > from ) { + if ( !si->num_glyphs ) + shape( i ); + + advance_t *advances = this->advances( si ); + unsigned short *logClusters = this->logClusters( si ); + +// fprintf( stderr, " logclusters:" ); +// for ( int k = 0; k < ilen; k++ ) +// fprintf( stderr, " %d", logClusters[k] ); +// fprintf( stderr, "\n" ); + // do the simple thing for now and give the first glyph in a cluster the full width, all other ones 0. + int charFrom = from - pos; + if ( charFrom < 0 ) + charFrom = 0; + int glyphStart = logClusters[charFrom]; + if ( charFrom > 0 && logClusters[charFrom-1] == glyphStart ) + while ( charFrom < ilen && logClusters[charFrom] == glyphStart ) + charFrom++; + if ( charFrom < ilen ) { + glyphStart = logClusters[charFrom]; + int charEnd = from + len - 1 - pos; + if ( charEnd >= ilen ) + charEnd = ilen-1; + int glyphEnd = logClusters[charEnd]; + while ( charEnd < ilen && logClusters[charEnd] == glyphEnd ) + charEnd++; + glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd]; + +// tqDebug("char: start=%d end=%d / glyph: start = %d, end = %d", charFrom, charEnd, glyphStart, glyphEnd ); + for ( int i = glyphStart; i < glyphEnd; i++ ) + w += advances[i]; + } + } + } +// tqDebug(" --> w= %d ", w ); + return w; +} + +void TQTextEngine::itemize( int mode ) +{ + if ( !items.d ) { + int size = 8; + items.d = (TQScriptItemArrayPrivate *)malloc( sizeof( TQScriptItemArrayPrivate ) + + sizeof( TQScriptItem ) * size ); + items.d->alloc = size; + } + items.d->size = 0; + if ( string.length() == 0 ) + return; + + if ( !(mode & NoBidi) ) { + if ( direction == TQChar::DirON ) + direction = basicDirection( string ); + bidiItemize( this, direction == TQChar::DirR, mode ); + } else { + BidiControl control( FALSE ); + if ( mode & TQTextEngine::SingleLine ) + control.singleLine = TRUE; + int start = 0; + int stop = string.length() - 1; + appendItems(this, start, stop, control, TQChar::DirL); + } + if ( (mode & WidthOnly) == WidthOnly ) + widthOnly = TRUE; +} + +glyph_metrics_t TQTextEngine::boundingBox( int from, int len ) const +{ + glyph_metrics_t gm; + + for ( int i = 0; i < items.size(); i++ ) { + TQScriptItem *si = &items[i]; + int pos = si->position; + int ilen = length( i ); + if ( pos > from + len ) + break; + if ( pos + len > from ) { + if ( !si->num_glyphs ) + shape( i ); + advance_t *advances = this->advances( si ); + unsigned short *logClusters = this->logClusters( si ); + glyph_t *glyphs = this->glyphs( si ); + qoffset_t *offsets = this->offsets( si ); + + // do the simple thing for now and give the first glyph in a cluster the full width, all other ones 0. + int charFrom = from - pos; + if ( charFrom < 0 ) + charFrom = 0; + int glyphStart = logClusters[charFrom]; + if ( charFrom > 0 && logClusters[charFrom-1] == glyphStart ) + while ( charFrom < ilen && logClusters[charFrom] == glyphStart ) + charFrom++; + if ( charFrom < ilen ) { + glyphStart = logClusters[charFrom]; + int charEnd = from + len - 1 - pos; + if ( charEnd >= ilen ) + charEnd = ilen-1; + int glyphEnd = logClusters[charEnd]; + while ( charEnd < ilen && logClusters[charEnd] == glyphEnd ) + charEnd++; + glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd]; + if ( glyphStart <= glyphEnd ) { + TQFontEngine *fe = si->fontEngine; + glyph_metrics_t m = fe->boundingBox( glyphs+glyphStart, advances+glyphStart, + offsets+glyphStart, glyphEnd-glyphStart ); + gm.x = TQMIN( gm.x, m.x + gm.xoff ); + gm.y = TQMIN( gm.y, m.y + gm.yoff ); + gm.width = TQMAX( gm.width, m.width+gm.xoff ); + gm.height = TQMAX( gm.height, m.height+gm.yoff ); + gm.xoff += m.xoff; + gm.yoff += m.yoff; + } + } + } + } + return gm; +} diff --git a/src/kernel/tqtextengine_p.h b/src/kernel/tqtextengine_p.h new file mode 100644 index 00000000..774302a0 --- /dev/null +++ b/src/kernel/tqtextengine_p.h @@ -0,0 +1,377 @@ +/**************************************************************************** +** +** ??? +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTENGINE_P_H +#define TQTEXTENGINE_P_H + +#ifndef QT_H +#include "ntqglobal.h" +#include "tqstring.h" +#include "ntqnamespace.h" +#include <private/qfontdata_p.h> +#endif // QT_H + +#include <stdlib.h> +#ifndef Q_OS_TEMP +#include <assert.h> +#endif // Q_OS_TEMP + +class TQFontPrivate; +class TQString; + +class TQOpenType; +class TQPainter; + +// this uses the same coordinate system as TQt, but a different one to freetype and Xft. +// * y is usually negative, and is equal to the ascent. +// * negative yoff means the following stuff is drawn higher up. +// the characters bounding rect is given by TQRect( x,y,width,height), it's advance by +// xoo and yoff +struct glyph_metrics_t +{ + inline glyph_metrics_t() { + x = 100000; + y = 100000; + width = 0; + height = 0; + xoff = 0; + yoff = 0; + } + inline glyph_metrics_t( int _x, int _y, int _width, int _height, int _xoff, int _yoff ) { + x = _x; + y = _y; + width = _width; + height = _height; + xoff = _xoff; + yoff = _yoff; + } + int x; + int y; + int width; + int height; + int xoff; + int yoff; +}; + +#if defined( TQ_WS_X11 ) || defined ( TQ_WS_QWS ) +typedef unsigned short glyph_t; + +struct qoffset_t { + short x; + short y; +}; + +typedef int advance_t; + +struct TQScriptAnalysis +{ + unsigned short script : 7; + unsigned short bidiLevel : 6; // Unicode Bidi algorithm embedding level (0-61) + unsigned short override : 1; // Set when in LRO/RLO embedding + unsigned short reserved : 2; + bool operator == ( const TQScriptAnalysis &other ) { + return + script == other.script && + bidiLevel == other.bidiLevel; + // ### +// && override == other.override; + } + +}; + +#elif defined( TQ_WS_MAC ) + +typedef unsigned short glyph_t; + +struct qoffset_t { + short x; + short y; +}; + +typedef int advance_t; + +struct TQScriptAnalysis +{ + unsigned short script : 7; + unsigned short bidiLevel : 6; // Unicode Bidi algorithm embedding level (0-61) + unsigned short override : 1; // Set when in LRO/RLO embedding + unsigned short reserved : 2; + bool operator == ( const TQScriptAnalysis &other ) { + return + script == other.script && + bidiLevel == other.bidiLevel; + // ### +// && override == other.override; + } + +}; + +#elif defined( TQ_WS_WIN ) + +// do not change the definitions below unless you know what you are doing! +// it is designed to be compatible with the types found in uniscribe. + +typedef unsigned short glyph_t; + +struct qoffset_t { + int x; + int y; +}; + +typedef int advance_t; + +struct TQScriptAnalysis { + unsigned short script :10; + unsigned short rtl :1; + unsigned short layoutRTL :1; + unsigned short linkBefore :1; + unsigned short linkAfter :1; + unsigned short logicalOrder :1; + unsigned short noGlyphIndex :1; + unsigned short bidiLevel :5; + unsigned short override :1; + unsigned short inhibitSymSwap :1; + unsigned short charShape :1; + unsigned short digitSubstitute :1; + unsigned short inhibitLigate :1; + unsigned short fDisplayZWG :1; + unsigned short arabicNumContext :1; + unsigned short gcpClusters :1; + unsigned short reserved :1; + unsigned short engineReserved :2; +}; + +inline bool operator == ( const TQScriptAnalysis &sa1, const TQScriptAnalysis &sa2 ) +{ + return + sa1.script == sa2.script && + sa1.bidiLevel == sa2.bidiLevel; + // ### +// && override == other.override; +} + +#endif + +// enum and struct are made to be compatible with Uniscribe, dont change unless you know what you're doing. +struct GlyphAttributes { + // highest value means highest priority for justification. Justification is done by first inserting kashidas + // starting with the highest priority positions, then stretching spaces, afterwards extending inter char + // spacing, and last spacing between arabic words. + // NoJustification is for example set for arabic where no Kashida can be inserted or for diacritics. + enum Justification { + NoJustification= 0, // Justification can't be applied after this glyph + Arabic_Space = 1, // This glyph represents a space inside arabic text + Character = 2, // Inter-character justification point follows this glyph + Space = 4, // This glyph represents a blank outside an Arabic run + Arabic_Normal = 7, // Normal Middle-Of-Word glyph that connects to the right (begin) + Arabic_Waw = 8, // Next character is final form of Waw/Ain/Qaf/Fa + Arabic_BaRa = 9, // Next two chars are Ba + Ra/Ya/AlefMaksura + Arabic_Alef = 10, // Next character is final form of Alef/Tah/Lam/Kaf/Gaf + Arabic_HaaDal = 11, // Next character is final form of Haa/Dal/Taa Marbutah + Arabic_Seen = 12, // Initial or Medial form Of Seen/Sad + Arabic_Kashida = 13 // Kashida(U+640) in middle of word + }; + unsigned short justification :4; // Justification class + unsigned short clusterStart :1; // First glyph of representation of cluster + unsigned short mark :1; // needs to be positioned around base char + unsigned short zeroWidth :1; // ZWJ, ZWNJ etc, with no width, currently used as "Don't print" for ZWSP + unsigned short reserved :1; + unsigned short combiningClass :8; +}; + +// also this is compatible to uniscribe. Do not change. +struct TQCharAttributes { + uchar softBreak :1; // Potential linebreak point _before_ this character + uchar whiteSpace :1; // A unicode whitespace character, except NBSP, ZWNBSP + uchar charStop :1; // Valid cursor position (for left/right arrow) + uchar wordStop :1; // Valid cursor position (for ctrl + left/right arrow) + uchar invalid :1; + uchar reserved :3; +}; + +inline bool qIsZeroWidthChar(ushort uc) +{ + return (uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) + || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) + || (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */); +} + +class TQFontEngine; + +struct TQScriptItem +{ + inline TQScriptItem() : position( 0 ), isSpace( FALSE ), isTab( FALSE ), + isObject( FALSE ), hasPositioning( FALSE ), + descent( -1 ), ascent( -1 ), width( -1 ), + x( 0 ), y( 0 ), num_glyphs( 0 ), glyph_data_offset( 0 ), + fontEngine( 0 ) { } + int position; + TQScriptAnalysis analysis; + unsigned short isSpace : 1; + unsigned short isTab : 1; + unsigned short isObject : 1; + unsigned short hasPositioning : 1; + unsigned short complex : 1; // Windows only + unsigned short private_use : 1; // Windows only + unsigned short reserved : 10; + short descent; + int ascent; + int width; + int x; + int y; + int num_glyphs; + int glyph_data_offset; + TQFontEngine *fontEngine; +}; + +struct TQScriptItemArrayPrivate +{ + unsigned int alloc; + unsigned int size; + TQScriptItem items[1]; +}; + +class TQScriptItemArray +{ +public: + TQScriptItemArray() : d( 0 ) {} + ~TQScriptItemArray(); + + inline TQScriptItem &operator[] (int i) const {return d->items[i]; } + inline void append( const TQScriptItem &item ) { + if ( d->size == d->alloc ) + resize( d->size + 1 ); + d->items[d->size] = item; + d->size++; + } + inline int size() const { return d ? d->size : 0; } + + void resize( int s ); + void clear(); + + TQScriptItemArrayPrivate *d; +private: +#ifdef TQ_DISABLE_COPY + TQScriptItemArray( const TQScriptItemArray & ); + TQScriptItemArray &operator = ( const TQScriptItemArray & ); +#endif +}; + +class TQFontPrivate; + +class TQ_EXPORT TQTextEngine { +public: + TQTextEngine( const TQString &str, TQFontPrivate *f ); + ~TQTextEngine(); + + enum Mode { + Full = 0x00, + NoBidi = 0x01, + SingleLine = 0x02, + WidthOnly = 0x07 + }; + + void itemize( int mode = Full ); + + static void bidiReorder( int numRuns, const TQ_UINT8 *levels, int *visualOrder ); + + const TQCharAttributes *attributes(); + void shape( int item ) const; + + // ### we need something for justification + + enum Edge { + Leading, + Trailing + }; + enum ShaperFlag { + RightToLeft = 0x0001, + Mirrored = 0x0001 + }; + + int width( int charFrom, int numChars ) const; + glyph_metrics_t boundingBox( int from, int len ) const; + + TQScriptItemArray items; + TQString string; + TQFontPrivate *fnt; + int lineWidth; + int widthUsed; + int firstItemInLine; + int currentItem; + TQChar::Direction direction : 5; + unsigned int haveCharAttributes : 1; + unsigned int widthOnly : 1; + unsigned int reserved : 25; + + int length( int item ) const { + const TQScriptItem &si = items[item]; + int from = si.position; + item++; + return ( item < items.size() ? items[item].position : string.length() ) - from; + } + void splitItem( int item, int pos ); + + unsigned short *logClustersPtr; + glyph_t *glyphPtr; + advance_t *advancePtr; + qoffset_t *offsetsPtr; + GlyphAttributes *glyphAttributesPtr; + + inline unsigned short *logClusters( const TQScriptItem *si ) const + { return logClustersPtr+si->position; } + inline glyph_t *glyphs( const TQScriptItem *si ) const + { return glyphPtr+si->glyph_data_offset; } + inline advance_t *advances( const TQScriptItem *si ) const + { return advancePtr+si->glyph_data_offset; } + inline qoffset_t *offsets( const TQScriptItem *si ) const + { return offsetsPtr+si->glyph_data_offset; } + inline GlyphAttributes *glyphAttributes( const TQScriptItem *si ) const + { return glyphAttributesPtr+si->glyph_data_offset; } + + void reallocate( int totalGlyphs ); + inline void ensureSpace( int nGlyphs ) const { + if ( num_glyphs - used < nGlyphs ) + ((TQTextEngine *)this)->reallocate( ( (used + nGlyphs + 16) >> 4 ) << 4 ); + } + + int allocated; + void **memory; + int num_glyphs; + int used; +}; + +#endif diff --git a/src/kernel/tqtextengine_unix.cpp b/src/kernel/tqtextengine_unix.cpp new file mode 100644 index 00000000..0d5e3b92 --- /dev/null +++ b/src/kernel/tqtextengine_unix.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Text engine classes +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <assert.h> + + +TQScriptItemArray::~TQScriptItemArray() +{ + clear(); + free( d ); +} + +void TQScriptItemArray::clear() +{ + if ( d ) { + for ( unsigned int i = 0; i < d->size; i++ ) { + TQScriptItem &si = d->items[i]; + if ( si.fontEngine ) + si.fontEngine->deref(); + } + d->size = 0; + } +} + +void TQScriptItemArray::resize( int s ) +{ + int alloc = (s + 8) >> 3 << 3; + d = (TQScriptItemArrayPrivate *)realloc( d, sizeof( TQScriptItemArrayPrivate ) + + sizeof( TQScriptItem ) * alloc ); + d->alloc = alloc; +} + +void TQTextEngine::shape( int item ) const +{ + assert( item < items.size() ); + TQScriptItem &si = items[item]; + + if ( si.num_glyphs ) + return; + + TQFont::Script script = (TQFont::Script)si.analysis.script; + si.glyph_data_offset = used; + + if ( !si.fontEngine ) + si.fontEngine = fnt->engineForScript( script ); + si.fontEngine->ref(); + + si.ascent = si.fontEngine->ascent(); + si.descent = si.fontEngine->descent(); + si.num_glyphs = 0; + + if ( si.fontEngine && si.fontEngine != (TQFontEngine*)-1 ) { + TQShaperItem shaper_item; + shaper_item.script = si.analysis.script; + shaper_item.string = &string; + shaper_item.from = si.position; + shaper_item.length = length(item); + shaper_item.font = si.fontEngine; + shaper_item.num_glyphs = TQMAX(int(num_glyphs - used), shaper_item.length); + shaper_item.flags = si.analysis.bidiLevel % 2 ? RightToLeft : 0; + shaper_item.has_positioning = FALSE; + + while (1) { +// tqDebug(" . num_glyphs=%d, used=%d, item.num_glyphs=%d", num_glyphs, used, shaper_item.num_glyphs); + ensureSpace(shaper_item.num_glyphs); + shaper_item.num_glyphs = num_glyphs - used; +// tqDebug(" .. num_glyphs=%d, used=%d, item.num_glyphs=%d", num_glyphs, used, shaper_item.num_glyphs); + shaper_item.glyphs = glyphs(&si); + shaper_item.advances = advances(&si); + shaper_item.offsets = offsets(&si); + shaper_item.attributes = glyphAttributes(&si); + shaper_item.log_clusters = logClusters(&si); + if (scriptEngines[shaper_item.script].shape(&shaper_item)) + break; + } + + si.num_glyphs = shaper_item.num_glyphs; + si.hasPositioning = shaper_item.has_positioning; + } + ((TQTextEngine *)this)->used += si.num_glyphs; + + si.width = 0; + advance_t *advances = this->advances( &si ); + advance_t *end = advances + si.num_glyphs; + while ( advances < end ) { +// tqDebug("advances[%d] = %d", advances - this->advances(&si), *advances); + si.width += *(advances++); + } + + return; +} + diff --git a/src/kernel/tqtextlayout.cpp b/src/kernel/tqtextlayout.cpp new file mode 100644 index 00000000..41be6076 --- /dev/null +++ b/src/kernel/tqtextlayout.cpp @@ -0,0 +1,643 @@ +/**************************************************************************** +** +** ??? +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextlayout_p.h" +#include "tqtextengine_p.h" + +#include <ntqfont.h> +#include <ntqapplication.h> +#include <ntqpainter.h> + + +TQRect TQTextItem::rect() const +{ + TQScriptItem& si = engine->items[item]; + return TQRect( si.x, si.y, si.width, si.ascent+si.descent ); +} + +int TQTextItem::x() const +{ + return engine->items[item].x; +} + +int TQTextItem::y() const +{ + return engine->items[item].y; +} + +int TQTextItem::width() const +{ + return engine->items[item].width; +} + +int TQTextItem::ascent() const +{ + return engine->items[item].ascent; +} + +int TQTextItem::descent() const +{ + return engine->items[item].descent; +} + +void TQTextItem::setWidth( int w ) +{ + engine->items[item].width = w; +} + +void TQTextItem::setAscent( int a ) +{ + engine->items[item].ascent = a; +} + +void TQTextItem::setDescent( int d ) +{ + engine->items[item].descent = d; +} + +int TQTextItem::from() const +{ + return engine->items[item].position; +} + +int TQTextItem::length() const +{ + return engine->length(item); +} + + +int TQTextItem::cursorToX( int *cPos, Edge edge ) const +{ + int pos = *cPos; + TQScriptItem *si = &engine->items[item]; + + engine->shape( item ); + advance_t *advances = engine->advances( si ); + GlyphAttributes *glyphAttributes = engine->glyphAttributes( si ); + unsigned short *logClusters = engine->logClusters( si ); + + int l = engine->length( item ); + if ( pos > l ) + pos = l; + if ( pos < 0 ) + pos = 0; + + int glyph_pos = pos == l ? si->num_glyphs : logClusters[pos]; + if ( edge == Trailing ) { + // trailing edge is leading edge of next cluster + while ( glyph_pos < si->num_glyphs && !glyphAttributes[glyph_pos].clusterStart ) + glyph_pos++; + } + + int x = 0; + bool reverse = engine->items[item].analysis.bidiLevel % 2; + + if ( reverse ) { + for ( int i = si->num_glyphs-1; i >= glyph_pos; i-- ) + x += advances[i]; + } else { + for ( int i = 0; i < glyph_pos; i++ ) + x += advances[i]; + } +// tqDebug("cursorToX: pos=%d, gpos=%d x=%d", pos, glyph_pos, x ); + *cPos = pos; + return x; +} + +int TQTextItem::xToCursor( int x, CursorPosition cpos ) const +{ + TQScriptItem *si = &engine->items[item]; + engine->shape( item ); + advance_t *advances = engine->advances( si ); + unsigned short *logClusters = engine->logClusters( si ); + + int l = engine->length( item ); + bool reverse = si->analysis.bidiLevel % 2; + if ( x < 0 ) + return reverse ? l : 0; + + + if ( reverse ) { + int width = 0; + for ( int i = 0; i < si->num_glyphs; i++ ) { + width += advances[i]; + } + x = -x + width; + } + int cp_before = 0; + int cp_after = 0; + int x_before = 0; + int x_after = 0; + + int lastCluster = 0; + for ( int i = 1; i <= l; i++ ) { + int newCluster = i < l ? logClusters[i] : si->num_glyphs; + if ( newCluster != lastCluster ) { + // calculate cluster width + cp_before = cp_after; + x_before = x_after; + cp_after = i; + for ( int j = lastCluster; j < newCluster; j++ ) + x_after += advances[j]; + // tqDebug("cluster boundary: lastCluster=%d, newCluster=%d, x_before=%d, x_after=%d", + // lastCluster, newCluster, x_before, x_after ); + if ( x_after > x ) + break; + lastCluster = newCluster; + } + } + + bool before = ( cpos == OnCharacters || (x - x_before) < (x_after - x) ); + +// tqDebug("got cursor position for %d: %d/%d, x_ba=%d/%d using %d", +// x, cp_before,cp_after, x_before, x_after, before ? cp_before : cp_after ); + + return before ? cp_before : cp_after; + +} + + +bool TQTextItem::isRightToLeft() const +{ + return (engine->items[item].analysis.bidiLevel % 2); +} + +bool TQTextItem::isObject() const +{ + return engine->items[item].isObject; +} + +bool TQTextItem::isSpace() const +{ + return engine->items[item].isSpace; +} + +bool TQTextItem::isTab() const +{ + return engine->items[item].isTab; +} + + +TQTextLayout::TQTextLayout() + :d(0) {} + +TQTextLayout::TQTextLayout( const TQString& string, TQPainter *p ) +{ + TQFontPrivate *f = p ? ( p->pfont ? p->pfont->d : p->cfont.d ) : TQApplication::font().d; + d = new TQTextEngine( (string.isNull() ? (const TQString&)TQString::fromLatin1("") : string), f ); +} + +TQTextLayout::TQTextLayout( const TQString& string, const TQFont& fnt ) +{ + d = new TQTextEngine( (string.isNull() ? (const TQString&)TQString::fromLatin1("") : string), fnt.d ); +} + +TQTextLayout::~TQTextLayout() +{ + delete d; +} + +void TQTextLayout::setText( const TQString& string, const TQFont& fnt ) +{ + delete d; + d = new TQTextEngine( (string.isNull() ? (const TQString&)TQString::fromLatin1("") : string), fnt.d ); +} + +/* add an additional item boundary eg. for style change */ +void TQTextLayout::setBoundary( int strPos ) +{ + if ( strPos <= 0 || strPos >= (int)d->string.length() ) + return; + + int itemToSplit = 0; + while ( itemToSplit < d->items.size() && d->items[itemToSplit].position <= strPos ) + itemToSplit++; + itemToSplit--; + if ( d->items[itemToSplit].position == strPos ) { + // already a split at the requested position + return; + } + d->splitItem( itemToSplit, strPos - d->items[itemToSplit].position ); +} + + +int TQTextLayout::numItems() const +{ + return d->items.size(); +} + +TQTextItem TQTextLayout::itemAt( int i ) const +{ + return TQTextItem( i, d ); +} + + +TQTextItem TQTextLayout::findItem( int strPos ) const +{ + if ( strPos == 0 && d->items.size() ) + return TQTextItem( 0, d ); + // ## TODO use bsearch + for ( int i = d->items.size()-1; i >= 0; --i ) { + if ( d->items[i].position < strPos ) + return TQTextItem( i, d ); + } + return TQTextItem(); +} + + +void TQTextLayout::beginLayout( TQTextLayout::LayoutMode m ) +{ + d->items.clear(); + TQTextEngine::Mode mode = TQTextEngine::Full; + if (m == NoBidi) + mode = TQTextEngine::NoBidi; + else if (m == SingleLine) + mode = TQTextEngine::SingleLine; + d->itemize( mode ); + d->currentItem = 0; + d->firstItemInLine = -1; +} + +void TQTextLayout::beginLine( int width ) +{ + d->lineWidth = width; + d->widthUsed = 0; + d->firstItemInLine = -1; +} + +bool TQTextLayout::atEnd() const +{ + return d->currentItem >= d->items.size(); +} + +TQTextItem TQTextLayout::nextItem() +{ + d->currentItem++; + + if ( d->currentItem >= d->items.size() ) + return TQTextItem(); + + d->shape( d->currentItem ); + return TQTextItem( d->currentItem, d ); +} + +TQTextItem TQTextLayout::currentItem() +{ + if ( d->currentItem >= d->items.size() ) + return TQTextItem(); + + d->shape( d->currentItem ); + return TQTextItem( d->currentItem, d ); +} + +/* ## maybe also currentItem() */ +void TQTextLayout::setLineWidth( int newWidth ) +{ + d->lineWidth = newWidth; +} + +int TQTextLayout::lineWidth() const +{ + return d->lineWidth; +} + +int TQTextLayout::widthUsed() const +{ + return d->widthUsed; +} + +int TQTextLayout::availableWidth() const +{ + return d->lineWidth - d->widthUsed; +} + + +/* returns true if completely added */ +TQTextLayout::Result TQTextLayout::addCurrentItem() +{ + if ( d->firstItemInLine == -1 ) + d->firstItemInLine = d->currentItem; + TQScriptItem ¤t = d->items[d->currentItem]; + d->shape( d->currentItem ); + d->widthUsed += current.width; +// tqDebug("trying to add item %d with width %d, remaining %d", d->currentItem, current.width, d->lineWidth-d->widthUsed ); + + d->currentItem++; + + return (d->widthUsed <= d->lineWidth + || (d->currentItem < d->items.size() && d->items[d->currentItem].isSpace)) ? Ok : LineFull; +} + +TQTextLayout::Result TQTextLayout::endLine( int x, int y, int alignment, + int *ascent, int *descent, int *lineLeft, int *lineRight ) +{ + int available = d->lineWidth; + int numRuns = 0; + int numSpaceItems = 0; + TQ_UINT8 _levels[128]; + int _visual[128]; + TQ_UINT8 *levels = _levels; + int *visual = _visual; + int i; + TQTextLayout::Result result = LineEmpty; + +// tqDebug("endLine x=%d, y=%d, first=%d, current=%d lw=%d wu=%d", x, y, d->firstItemInLine, d->currentItem, d->lineWidth, d->widthUsed ); + int width_nobreak_found = d->widthUsed; + if ( d->firstItemInLine == -1 ) + goto end; + + if ( !(alignment & (TQt::SingleLine|TQt::IncludeTrailingSpaces)) + && d->currentItem > d->firstItemInLine && d->items[d->currentItem-1].isSpace ) { + int i = d->currentItem-1; + while ( i > d->firstItemInLine && d->items[i].isSpace ) { + numSpaceItems++; + d->widthUsed -= d->items[i--].width; + } + } + + if ( (alignment & (TQt::WordBreak|TQt::BreakAnywhere)) && + d->widthUsed > d->lineWidth ) { + // find linebreak + + // even though we removed trailing spaces the line was too wide. We'll have to break at an earlier + // position. To not confuse the layouting below, reset the number of space items + numSpaceItems = 0; + + + bool breakany = alignment & TQt::BreakAnywhere; + + const TQCharAttributes *attrs = d->attributes(); + int w = 0; + int itemWidth = 0; + int breakItem = d->firstItemInLine; + int breakPosition = -1; +#if 0 + // we iterate backwards or forward depending on what we guess is closer + if ( d->widthUsed - d->lineWidth < d->lineWidth ) { + // backwards search should be faster + + } else +#endif + { + int tmpWidth = 0; + int swidth = 0; + // forward search is probably faster + for ( int i = d->firstItemInLine; i < d->currentItem; i++ ) { + const TQScriptItem *si = &d->items[i]; + int length = d->length( i ); + const TQCharAttributes *itemAttrs = attrs + si->position; + + advance_t *advances = d->advances( si ); + unsigned short *logClusters = d->logClusters( si ); + + int lastGlyph = 0; + int tmpItemWidth = 0; + +// tqDebug("looking for break in item %d, isSpace=%d", i, si->isSpace ); + if(si->isSpace && !(alignment & (TQt::SingleLine|TQt::IncludeTrailingSpaces))) { + swidth += si->width; + } else { + tmpWidth += swidth; + swidth = 0; + for ( int pos = 0; pos < length; pos++ ) { +// tqDebug("advance=%d, w=%d, tmpWidth=%d, softbreak=%d, whitespace=%d", +// *advances, w, tmpWidth, itemAttrs->softBreak, itemAttrs->whiteSpace ); + int glyph = logClusters[pos]; + if ( lastGlyph != glyph ) { + while ( lastGlyph < glyph ) + tmpItemWidth += advances[lastGlyph++]; + if ( breakPosition != -1 && w + tmpWidth + tmpItemWidth > d->lineWidth ) { +// tqDebug("found break at w=%d, tmpWidth=%d, tmpItemWidth=%d", w, tmpWidth, tmpItemWidth); + d->widthUsed = w; + goto found; + } + } + if ( (itemAttrs->softBreak || + ( breakany && itemAttrs->charStop ) ) && + (i != d->firstItemInLine || pos != 0) ) { + if ( breakItem != i ) + itemWidth = 0; + if (itemAttrs->softBreak) + breakany = FALSE; + breakItem = i; + breakPosition = pos; +// tqDebug("found possible break at item %d, position %d (absolute=%d), w=%d, tmpWidth=%d, tmpItemWidth=%d", breakItem, breakPosition, d->items[breakItem].position+breakPosition, w, tmpWidth, tmpItemWidth); + w += tmpWidth + tmpItemWidth; + itemWidth += tmpItemWidth; + tmpWidth = 0; + tmpItemWidth = 0; + } + itemAttrs++; + } + while ( lastGlyph < si->num_glyphs ) + tmpItemWidth += advances[lastGlyph++]; + tmpWidth += tmpItemWidth; + if ( w + tmpWidth > d->lineWidth ) { + d->widthUsed = w; + goto found; + } + } + } + } + + found: + // no valid break point found + if ( breakPosition == -1 ) { + d->widthUsed = width_nobreak_found; + goto nobreak; + } + +// tqDebug("linebreak at item %d, position %d, wu=%d", breakItem, breakPosition, d->widthUsed ); + // split the line + if ( breakPosition > 0 ) { +// int length = d->length( breakItem ); + +// tqDebug("splitting item, itemWidth=%d", itemWidth); + // not a full item, need to break + d->splitItem( breakItem, breakPosition ); + d->currentItem = breakItem+1; + } else { + d->currentItem = breakItem; + } + } + + result = Ok; + + nobreak: + // position the objects in the line + available -= d->widthUsed; + + numRuns = d->currentItem - d->firstItemInLine - numSpaceItems; + if ( numRuns > 127 ) { + levels = new TQ_UINT8[numRuns]; + visual = new int[numRuns]; + } + +// tqDebug("reordering %d runs, numSpaceItems=%d", numRuns, numSpaceItems ); + for ( i = 0; i < numRuns; i++ ) { + levels[i] = d->items[i+d->firstItemInLine].analysis.bidiLevel; +// tqDebug(" level = %d", d->items[i+d->firstItemInLine].analysis.bidiLevel ); + } + d->bidiReorder( numRuns, levels, visual ); + + end: + // ### FIXME + if ( alignment & TQt::AlignJustify ) { + // #### justify items + alignment = TQt::AlignAuto; + } + if ( (alignment & TQt::AlignHorizontal_Mask) == TQt::AlignAuto ) + alignment = TQt::AlignLeft; + if ( alignment & TQt::AlignRight ) + x += available; + else if ( alignment & TQt::AlignHCenter ) + x += available/2; + + + int asc = ascent ? *ascent : 0; + int desc = descent ? *descent : 0; + + for ( i = 0; i < numRuns; i++ ) { + TQScriptItem &si = d->items[d->firstItemInLine+visual[i]]; + asc = TQMAX( asc, si.ascent ); + desc = TQMAX( desc, si.descent ); + } + + int left = x; + for ( i = 0; i < numRuns; i++ ) { + TQScriptItem &si = d->items[d->firstItemInLine+visual[i]]; +// tqDebug("positioning item %d with width %d (from=%d/length=%d) at %d", d->firstItemInLine+visual[i], si.width, si.position, +// d->length(d->firstItemInLine+visual[i]), x ); + si.x = x; + si.y = y + asc; + x += si.width; + } + int right = x; + + if ( numSpaceItems ) { + if ( d->items[d->firstItemInLine+numRuns].analysis.bidiLevel % 2 ) { + x = left; + for ( i = 0; i < numSpaceItems; i++ ) { + TQScriptItem &si = d->items[d->firstItemInLine + numRuns + i]; + x -= si.width; + si.x = x; + si.y = y + asc; + } + } else { + for ( i = 0; i < numSpaceItems; i++ ) { + TQScriptItem &si = d->items[d->firstItemInLine + numRuns + i]; + si.x = x; + si.y = y + asc; + x += si.width; + } + } + } + + if ( lineLeft ) + *lineLeft = left; + if ( lineRight ) + *lineRight = right; + if ( ascent ) + *ascent = asc; + if ( descent ) + *descent = desc; + + if (levels != _levels) + delete []levels; + if (visual != _visual) + delete []visual; + + return result; +} + +void TQTextLayout::endLayout() +{ + // nothing to do currently +} + + +int TQTextLayout::nextCursorPosition( int oldPos, CursorMode mode ) const +{ +// tqDebug("looking for next cursor pos for %d", oldPos ); + const TQCharAttributes *attributes = d->attributes(); + int len = d->string.length(); + if ( oldPos >= len ) + return oldPos; + oldPos++; + if ( mode == SkipCharacters ) { + while ( oldPos < len && !attributes[oldPos].charStop ) + oldPos++; + } else { + while ( oldPos < len && !attributes[oldPos].wordStop && !attributes[oldPos-1].whiteSpace ) + oldPos++; + } +// tqDebug(" -> %d", oldPos ); + return oldPos; +} + +int TQTextLayout::previousCursorPosition( int oldPos, CursorMode mode ) const +{ +// tqDebug("looking for previous cursor pos for %d", oldPos ); + const TQCharAttributes *attributes = d->attributes(); + if ( oldPos <= 0 ) + return 0; + oldPos--; + if ( mode == SkipCharacters ) { + while ( oldPos && !attributes[oldPos].charStop ) + oldPos--; + } else { + while ( oldPos && !attributes[oldPos].wordStop && !attributes[oldPos-1].whiteSpace ) + oldPos--; + } +// tqDebug(" -> %d", oldPos ); + return oldPos; +} + + +bool TQTextLayout::validCursorPosition( int pos ) const +{ + const TQCharAttributes *attributes = d->attributes(); + if ( pos < 0 || pos > (int)d->string.length() ) + return FALSE; + return attributes[pos].charStop; +} + +void TQTextLayout::setDirection(TQChar::Direction dir) +{ + d->direction = dir; +} diff --git a/src/kernel/tqtextlayout_p.h b/src/kernel/tqtextlayout_p.h new file mode 100644 index 00000000..64c7f64d --- /dev/null +++ b/src/kernel/tqtextlayout_p.h @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** ??? +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid TQt Commercial licenses may use this file in +** accordance with the TQt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTLAYOUT_P_H +#define TQTEXTLAYOUT_P_H + +#ifndef QT_H +#include "tqstring.h" +#include "ntqnamespace.h" +#include "ntqrect.h" +#endif // QT_H + +class TQTextEngine; +class TQFont; + +class TQ_EXPORT TQTextItem +{ +public: + inline TQTextItem() : item(0), engine(0) {} + inline bool isValid() const { return (bool)engine; } + + TQRect rect() const; + int x() const; + int y() const; + int width() const; + int ascent() const; + int descent() const; + + enum Edge { + Leading, + Trailing + }; + enum CursorPosition { + BetweenCharacters, + OnCharacters + }; + + /* cPos gets set to the valid position */ + int cursorToX( int *cPos, Edge edge = Leading ) const; + inline int cursorToX( int cPos, Edge edge = Leading ) const { return cursorToX( &cPos, edge ); } + int xToCursor( int x, CursorPosition = BetweenCharacters ) const; + + bool isRightToLeft() const; + bool isObject() const; + bool isSpace() const; + bool isTab() const; + + void setWidth( int w ); + void setAscent( int a ); + void setDescent( int d ); + + int from() const; + int length() const; + +private: + friend class TQTextLayout; + friend class TQPainter; + friend class TQPSPrinter; + TQTextItem( int i, TQTextEngine *e ) : item( i ), engine( e ) {} + int item; + TQTextEngine *engine; +}; + + +class TQPainter; + +class TQ_EXPORT TQTextLayout +{ +public: + // does itemization + TQTextLayout(); + TQTextLayout( const TQString& string, TQPainter * = 0 ); + TQTextLayout( const TQString& string, const TQFont& fnt ); + ~TQTextLayout(); + + void setText( const TQString& string, const TQFont& fnt ); + + enum LineBreakStrategy { + AtWordBoundaries, + AtCharBoundaries + }; + + /* add an additional item boundary eg. for style change */ + void setBoundary( int strPos ); + + int numItems() const; + TQTextItem itemAt( int i ) const; + TQTextItem findItem( int strPos ) const; + + enum LayoutMode { + NoBidi, + SingleLine, + MultiLine + }; + void beginLayout( LayoutMode m = MultiLine ); + void beginLine( int width ); + + bool atEnd() const; + TQTextItem nextItem(); + TQTextItem currentItem(); + /* ## maybe also currentItem() */ + void setLineWidth( int newWidth ); + int lineWidth() const; + int widthUsed() const; + int availableWidth() const; + + enum Result { + Ok, + LineFull, + LineEmpty, + Error + }; + /* returns true if completely added */ + Result addCurrentItem(); + + /* Note: if ascent and descent are used they must be initialized to the minimum ascent/descent + acceptable for the line. TQFontMetrics::ascent/descent() is usually the right choice */ + Result endLine( int x = 0, int y = 0, int alignment = TQt::AlignLeft, + int *ascent = 0, int *descent = 0, int *left = 0, int *right = 0 ); + void endLayout(); + + enum CursorMode { + SkipCharacters, + SkipWords + }; + bool validCursorPosition( int pos ) const; + int nextCursorPosition( int oldPos, CursorMode mode = SkipCharacters ) const; + int previousCursorPosition( int oldPos, CursorMode mode = SkipCharacters ) const; + + void setDirection(TQChar::Direction); +private: + TQTextLayout( TQTextEngine *e ) : d( e ) {} + /* disable copy and assignment */ + TQTextLayout( const TQTextLayout & ) {} + void operator = ( const TQTextLayout & ) {} + + friend class TQTextItem; + friend class TQPainter; + friend class TQPSPrinter; + TQTextEngine *d; +}; + + +/* + class TQPainter { + ..... + void drawTextItem( int x, int y, TQTextItem *item ); + }; +*/ + +#endif diff --git a/src/kernel/tqwidget_x11.cpp b/src/kernel/tqwidget_x11.cpp index ff33dddb..78d1e850 100644 --- a/src/kernel/tqwidget_x11.cpp +++ b/src/kernel/tqwidget_x11.cpp @@ -47,7 +47,7 @@ #include "tqimage.h" #include "tqobjectlist.h" #include "ntqlayout.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqdatetime.h" #include "ntqcursor.h" #include "qt_x11_p.h" @@ -3055,7 +3055,7 @@ void TQWidget::destroyInputContext() /*! This function is called when text widgets need to be neutral state to - execute text operations properly. See qlineedit.cpp and qtextedit.cpp as + execute text operations properly. See qlineedit.cpp and tqtextedit.cpp as example. Ordinary reset that along with changing focus to another widget, diff --git a/src/moc/moc.pro b/src/moc/moc.pro index e2f92ef1..566a8589 100644 --- a/src/moc/moc.pro +++ b/src/moc/moc.pro @@ -31,11 +31,11 @@ SOURCES = ../tools/qbuffer.cpp \ ../tools/qlocale.cpp \ ../tools/qunicodetables.cpp \ ../tools/tqstringlist.cpp \ - ../tools/qtextstream.cpp \ + ../tools/tqtextstream.cpp \ ../tools/qbitarray.cpp \ ../tools/tqmap.cpp \ ../tools/qgcache.cpp \ - ../codecs/qtextcodec.cpp \ + ../codecs/tqtextcodec.cpp \ ../codecs/qutfcodec.cpp isEmpty(QT_PRODUCT)|contains(QT_PRODUCT, qt-internal) { diff --git a/src/network/qdns.cpp b/src/network/qdns.cpp index 4be302d5..dc641569 100644 --- a/src/network/qdns.cpp +++ b/src/network/qdns.cpp @@ -74,7 +74,7 @@ #include "tqstrlist.h" #include "tqptrdict.h" #include "ntqfile.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqsocketdevice.h" #include "ntqcleanuphandler.h" #include <limits.h> diff --git a/src/network/qftp.cpp b/src/network/qftp.cpp index ac4d442e..b5da887d 100644 --- a/src/network/qftp.cpp +++ b/src/network/qftp.cpp @@ -53,7 +53,7 @@ #include "tqptrdict.h" // binary compatibility #ifndef TQT_NO_TEXTCODEC -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif //#define TQFTPPI_DEBUG diff --git a/src/network/qhttp.cpp b/src/network/qhttp.cpp index 8f88e034..b37d4789 100644 --- a/src/network/qhttp.cpp +++ b/src/network/qhttp.cpp @@ -43,7 +43,7 @@ #ifndef TQT_NO_NETWORKPROTOCOL_HTTP #include "ntqsocket.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "tqmap.h" #include "tqstring.h" #include "tqstringlist.h" diff --git a/src/qt.pro b/src/qt.pro index e66adeef..e359ea36 100644 --- a/src/qt.pro +++ b/src/qt.pro @@ -182,14 +182,14 @@ wince-* { $$KERNEL_CPP/ntqgplugin.h \ $$KERNEL_CPP/tqimageformatplugin.h \ $$STYLES_CPP/ntqstyleplugin.h \ - $$CODECS_CPP/ntqtextcodecplugin.h \ + $$CODECS_CPP/tqtextcodecplugin.h \ $$WIDGETS_CPP/tqwidgetplugin.h SOURCES -= $$TOOLS_CPP/qcomlibrary.cpp \ $$KERNEL_CPP/qgplugin.cpp \ $$KERNEL_CPP/tqimageformatplugin.cpp \ $$STYLES_CPP/qstyleplugin.cpp \ - $$CODECS_CPP/qtextcodecplugin.cpp \ + $$CODECS_CPP/tqtextcodecplugin.cpp \ $$WIDGETS_CPP/tqwidgetplugin.cpp } diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index 54b9bfc8..8fd36f70 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -54,7 +54,7 @@ #include "ntqscrollbar.h" #include "ntqcombobox.h" #include "ntqslider.h" -#include "ntqtextedit.h" +#include "tqtextedit.h" #include "ntqtoolbar.h" #include "ntqlineedit.h" #include "ntqmenubar.h" diff --git a/src/tools/ntqtextstream.h b/src/tools/ntqtextstream.h deleted file mode 100644 index ab2366b3..00000000 --- a/src/tools/ntqtextstream.h +++ /dev/null @@ -1,341 +0,0 @@ -/**************************************************************************** -** -** Definition of TQTextStream class -** -** Created : 940922 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTSTREAM_H -#define TQTEXTSTREAM_H - -#ifndef QT_H -#include "ntqiodevice.h" -#include "tqstring.h" -#include <stdio.h> -#endif // QT_H - -#ifndef TQT_NO_TEXTSTREAM -class TQTextCodec; -class TQTextDecoder; - -class TQTextStreamPrivate; - -class TQ_EXPORT TQTextStream // text stream class -{ -public: - enum Encoding { Locale, Latin1, Unicode, UnicodeNetworkOrder, - UnicodeReverse, RawUnicode, UnicodeUTF8 }; - - void setEncoding( Encoding ); -#ifndef TQT_NO_TEXTCODEC - void setCodec( TQTextCodec* ); - TQTextCodec *codec(); -#endif - - TQTextStream(); - TQTextStream( TQIODevice * ); - TQTextStream( TQString*, int mode ); - TQTextStream( TQString&, int mode ); // obsolete - TQTextStream( TQByteArray, int mode ); - TQTextStream( FILE *, int mode ); - virtual ~TQTextStream(); - - TQIODevice *device() const; - void setDevice( TQIODevice * ); - void unsetDevice(); - - bool atEnd() const; - bool eof() const; - - TQTextStream &operator>>( TQChar & ); - TQTextStream &operator>>( char & ); - TQTextStream &operator>>( signed short & ); - TQTextStream &operator>>( unsigned short & ); - TQTextStream &operator>>( signed int & ); - TQTextStream &operator>>( unsigned int & ); - TQTextStream &operator>>( signed long & ); - TQTextStream &operator>>( unsigned long & ); - TQTextStream &operator>>( float & ); - TQTextStream &operator>>( double & ); - TQTextStream &operator>>( char * ); - TQTextStream &operator>>( TQString & ); - TQTextStream &operator>>( TQCString & ); - - TQTextStream &operator<<( TQChar ); - TQTextStream &operator<<( char ); - TQTextStream &operator<<( signed short ); - TQTextStream &operator<<( unsigned short ); - TQTextStream &operator<<( signed int ); - TQTextStream &operator<<( unsigned int ); - TQTextStream &operator<<( signed long ); - TQTextStream &operator<<( unsigned long ); - TQTextStream &operator<<( signed long long ); - TQTextStream &operator<<( unsigned long long ); - TQTextStream &operator<<( float ); - TQTextStream &operator<<( double ); - TQTextStream &operator<<( const char* ); - TQTextStream &operator<<( const TQString & ); - TQTextStream &operator<<( const TQCString & ); - TQTextStream &operator<<( void * ); // any pointer - - TQTextStream &readRawBytes( char *, uint len ); - TQTextStream &writeRawBytes( const char* , uint len ); - - TQString readLine(); - TQString read(); - void skipWhiteSpace(); - - enum { - skipws = 0x0001, // skip whitespace on input - left = 0x0002, // left-adjust output - right = 0x0004, // right-adjust output - internal = 0x0008, // pad after sign - bin = 0x0010, // binary format integer - oct = 0x0020, // octal format integer - dec = 0x0040, // decimal format integer - hex = 0x0080, // hex format integer - showbase = 0x0100, // show base indicator - showpoint = 0x0200, // force decimal point (float) - uppercase = 0x0400, // upper-case hex output - showpos = 0x0800, // add '+' to positive integers - scientific= 0x1000, // scientific float output - fixed = 0x2000 // fixed float output - }; - - static const int basefield; // bin | oct | dec | hex - static const int adjustfield; // left | right | internal - static const int floatfield; // scientific | fixed - - int flags() const; - int flags( int f ); - int setf( int bits ); - int setf( int bits, int mask ); - int unsetf( int bits ); - - void reset(); - - int width() const; - int width( int ); - int fill() const; - int fill( int ); - int precision() const; - int precision( int ); - -private: - long input_int(); - void init(); - TQTextStream &output_int( int, unsigned long long, bool ); - - TQIODevice *dev; - - int fflags; - int fwidth; - int fillchar; - int fprec; - bool doUnicodeHeader; - bool owndev; - TQTextCodec *mapper; - TQTextStreamPrivate * d; - TQChar unused1; // ### remove in TQt 4.0 - bool latin1; - bool internalOrder; - bool networkOrder; - void *unused2; // ### remove in TQt 4.0 - - TQChar eat_ws(); - uint ts_getline( TQChar* ); - void ts_ungetc( TQChar ); - TQChar ts_getc(); - uint ts_getbuf( TQChar*, uint ); - void ts_putc(int); - void ts_putc(TQChar); - bool ts_isspace(TQChar); - bool ts_isdigit(TQChar); - ulong input_bin(); - ulong input_oct(); - ulong input_dec(); - ulong input_hex(); - double input_double(); - TQTextStream &writeBlock( const char* p, uint len ); - TQTextStream &writeBlock( const TQChar* p, uint len ); - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQTextStream( const TQTextStream & ); - TQTextStream &operator=( const TQTextStream & ); -#endif -}; - -typedef TQTextStream TQTS; - -class TQ_EXPORT TQTextIStream : public TQTextStream { -public: - TQTextIStream( const TQString* s ) : - TQTextStream((TQString*)s,IO_ReadOnly) { } - TQTextIStream( TQByteArray ba ) : - TQTextStream(ba,IO_ReadOnly) { } - TQTextIStream( FILE *f ) : - TQTextStream(f,IO_ReadOnly) { } - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQTextIStream( const TQTextIStream & ); - TQTextIStream &operator=( const TQTextIStream & ); -#endif -}; - -class TQ_EXPORT TQTextOStream : public TQTextStream { -public: - TQTextOStream( TQString* s ) : - TQTextStream(s,IO_WriteOnly) { } - TQTextOStream( TQByteArray ba ) : - TQTextStream(ba,IO_WriteOnly) { } - TQTextOStream( FILE *f ) : - TQTextStream(f,IO_WriteOnly) { } - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQTextOStream( const TQTextOStream & ); - TQTextOStream &operator=( const TQTextOStream & ); -#endif -}; - -/***************************************************************************** - TQTextStream inline functions - *****************************************************************************/ - -inline TQIODevice *TQTextStream::device() const -{ return dev; } - -inline bool TQTextStream::atEnd() const -{ return dev ? dev->atEnd() : FALSE; } - -inline bool TQTextStream::eof() const -{ return atEnd(); } - -inline int TQTextStream::flags() const -{ return fflags; } - -inline int TQTextStream::flags( int f ) -{ int oldf = fflags; fflags = f; return oldf; } - -inline int TQTextStream::setf( int bits ) -{ int oldf = fflags; fflags |= bits; return oldf; } - -inline int TQTextStream::setf( int bits, int mask ) -{ int oldf = fflags; fflags = (fflags & ~mask) | (bits & mask); return oldf; } - -inline int TQTextStream::unsetf( int bits ) -{ int oldf = fflags; fflags &= ~bits; return oldf; } - -inline int TQTextStream::width() const -{ return fwidth; } - -inline int TQTextStream::width( int w ) -{ int oldw = fwidth; fwidth = w; return oldw; } - -inline int TQTextStream::fill() const -{ return fillchar; } - -inline int TQTextStream::fill( int f ) -{ int oldc = fillchar; fillchar = f; return oldc; } - -inline int TQTextStream::precision() const -{ return fprec; } - -inline int TQTextStream::precision( int p ) -{ int oldp = fprec; fprec = p; return oldp; } - -/*! - Returns one character from the stream, or EOF. -*/ -inline TQChar TQTextStream::ts_getc() -{ TQChar r; return ( ts_getbuf( &r,1 ) == 1 ? r : TQChar((ushort)0xffff) ); } - -/***************************************************************************** - TQTextStream manipulators - *****************************************************************************/ - -typedef TQTextStream & (*TQTSFUNC)(TQTextStream &);// manipulator function -typedef int (TQTextStream::*TQTSMFI)(int); // manipulator w/int argument - -class TQ_EXPORT TQTSManip { // text stream manipulator -public: - TQTSManip( TQTSMFI m, int a ) { mf=m; arg=a; } - void exec( TQTextStream &s ) { (s.*mf)(arg); } -private: - TQTSMFI mf; // TQTextStream member function - int arg; // member function argument -}; - -TQ_EXPORT inline TQTextStream &operator>>( TQTextStream &s, TQTSFUNC f ) -{ return (*f)( s ); } - -TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSFUNC f ) -{ return (*f)( s ); } - -TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSManip m ) -{ m.exec(s); return s; } - -TQ_EXPORT TQTextStream &bin( TQTextStream &s ); // set bin notation -TQ_EXPORT TQTextStream &oct( TQTextStream &s ); // set oct notation -TQ_EXPORT TQTextStream &dec( TQTextStream &s ); // set dec notation -TQ_EXPORT TQTextStream &hex( TQTextStream &s ); // set hex notation -TQ_EXPORT TQTextStream &endl( TQTextStream &s ); // insert EOL ('\n') -TQ_EXPORT TQTextStream &flush( TQTextStream &s ); // flush output -TQ_EXPORT TQTextStream &ws( TQTextStream &s ); // eat whitespace on input -TQ_EXPORT TQTextStream &reset( TQTextStream &s ); // set default flags - -TQ_EXPORT inline TQTSManip qSetW( int w ) -{ - TQTSMFI func = &TQTextStream::width; - return TQTSManip(func,w); -} - -TQ_EXPORT inline TQTSManip qSetFill( int f ) -{ - TQTSMFI func = &TQTextStream::fill; - return TQTSManip(func,f); -} - -TQ_EXPORT inline TQTSManip qSetPrecision( int p ) -{ - TQTSMFI func = &TQTextStream::precision; - return TQTSManip(func,p); -} - -#endif // TQT_NO_TEXTSTREAM -#endif // TQTEXTSTREAM_H diff --git a/src/tools/ntqtl.h b/src/tools/ntqtl.h index 8b8724f9..71212974 100644 --- a/src/tools/ntqtl.h +++ b/src/tools/ntqtl.h @@ -43,7 +43,7 @@ #ifndef QT_H #include "ntqglobal.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "tqstring.h" #endif // QT_H diff --git a/src/tools/qfeatures.txt b/src/tools/qfeatures.txt index 3c14ef27..fd6cb62c 100644 --- a/src/tools/qfeatures.txt +++ b/src/tools/qfeatures.txt @@ -194,7 +194,7 @@ SeeAlso: ??? Feature: TEXTSTREAM Section: File I/O Requires: -Name: QTextStream +Name: TQTextStream SeeAlso: ??? Feature: DATASTREAM @@ -993,7 +993,7 @@ SeeAlso: ??? Feature: TEXTVIEW Section: Widgets Requires: TEXTEDIT -Name: QTextView +Name: TQTextView SeeAlso: ??? Feature: TEXTEDIT @@ -1090,7 +1090,7 @@ SeeAlso: ??? Feature: TEXTBROWSER Section: Widgets Requires: TEXTVIEW MIME -Name: QTextBrowser +Name: TQTextBrowser SeeAlso: ??? Feature: LISTBOX @@ -1276,7 +1276,7 @@ SeeAlso: ??? Feature: TEXTCODECPLUGIN Section: Internationalization Requires: COMPONENT TEXTCODEC -Name: QTextCodecPlugin +Name: TQTextCodecPlugin SeeAlso: ??? diff --git a/src/tools/qsettings.cpp b/src/tools/qsettings.cpp index ecaa3f7d..ebec8188 100644 --- a/src/tools/qsettings.cpp +++ b/src/tools/qsettings.cpp @@ -61,7 +61,7 @@ static inline int qt_open( const char *pathname, int flags, mode_t mode ) #include "ntqfile.h" #include "ntqfileinfo.h" #include "tqmap.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqregexp.h" #include <private/qsettings_p.h> #ifndef NO_ERRNO_H diff --git a/src/tools/qt_tools.pri b/src/tools/qt_tools.pri index 283d7c5e..54cfd441 100644 --- a/src/tools/qt_tools.pri +++ b/src/tools/qt_tools.pri @@ -55,7 +55,7 @@ tools { $$TOOLS_H/tqstringlist.h \ $$TOOLS_H/tqstrlist.h \ $$TOOLS_H/tqstrvec.h \ - $$TOOLS_H/ntqtextstream.h \ + $$TOOLS_H/tqtextstream.h \ $$TOOLS_P/qthreadinstance_p.h \ $$TOOLS_H/ntqthreadstorage.h\ $$TOOLS_P/qunicodetables_p.h \ @@ -135,7 +135,7 @@ tools { $$TOOLS_CPP/qsemaphore.cpp \ $$TOOLS_CPP/qsettings.cpp \ $$TOOLS_CPP/tqstringlist.cpp \ - $$TOOLS_CPP/qtextstream.cpp \ + $$TOOLS_CPP/tqtextstream.cpp \ $$TOOLS_CPP/qunicodetables.cpp \ $$TOOLS_CPP/qucom.cpp \ $$TOOLS_CPP/quuid.cpp diff --git a/src/tools/qtextstream.cpp b/src/tools/qtextstream.cpp deleted file mode 100644 index 85059daf..00000000 --- a/src/tools/qtextstream.cpp +++ /dev/null @@ -1,2632 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQTextStream class -** -** Created : 940922 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the tools module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqtextstream.h" - -#ifndef TQT_NO_TEXTSTREAM -#include "ntqtextcodec.h" -#include "ntqregexp.h" -#include "ntqbuffer.h" -#include "ntqfile.h" -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#ifndef Q_OS_TEMP -#include <locale.h> -#endif - -#if defined(Q_OS_WIN32) -#include "qt_windows.h" -#endif - -/*! - \class TQTextStream ntqtextstream.h - \reentrant - \brief The TQTextStream class provides basic functions for reading - and writing text using a TQIODevice. - - \ingroup io - \ingroup text - \mainclass - - The text stream class has a functional interface that is very - similar to that of the standard C++ iostream class. - - TQt provides several global functions similar to the ones in iostream: - \table - \header \i Function \i Meaning - \row \i bin \i sets the TQTextStream to read/write binary numbers - \row \i oct \i sets the TQTextStream to read/write octal numbers - \row \i dec \i sets the TQTextStream to read/write decimal numbers - \row \i hex \i sets the TQTextStream to read/write hexadecimal numbers - \row \i endl \i forces a line break - \row \i flush \i forces the TQIODevice to flush any buffered data - \row \i ws \i eats any available whitespace (on input) - \row \i reset \i resets the TQTextStream to its default mode (see reset()) - \row \i qSetW(int) \i sets the \link width() field width \endlink - to the given argument - \row \i qSetFill(int) \i sets the \link fill() fill character - \endlink to the given argument - \row \i qSetPrecision(int) \i sets the \link precision() precision - \endlink to the given argument - \endtable - - \warning By default TQTextStream will automatically detect whether - integers in the stream are in decimal, octal, hexadecimal or - binary format when reading from the stream. In particular, a - leading '0' signifies octal, i.e. the sequence "0100" will be - interpreted as 64. - - The TQTextStream class reads and writes text; it is not appropriate - for dealing with binary data (but TQDataStream is). - - By default, output of Unicode text (i.e. TQString) is done using - the local 8-bit encoding. This can be changed using the - setEncoding() method. For input, the TQTextStream will auto-detect - standard Unicode "byte order marked" text files; otherwise the - local 8-bit encoding is used. - - The TQIODevice is set in the constructor, or later using - setDevice(). If the end of the input is reached atEnd() returns - TRUE. Data can be read into variables of the appropriate type - using the operator>>() overloads, or read in its entirety into a - single string using read(), or read a line at a time using - readLine(). Whitespace can be skipped over using skipWhiteSpace(). - You can set flags for the stream using flags() or setf(). The - stream also supports width(), precision() and fill(); use reset() - to reset the defaults. - - \sa TQDataStream -*/ - -/*! - \enum TQTextStream::Encoding - - \value Locale - \value Latin1 - \value Unicode - \value UnicodeNetworkOrder - \value UnicodeReverse - \value RawUnicode - \value UnicodeUTF8 - - See setEncoding() for an explanation of the encodings. -*/ - -/* - \class TQTSManip - - \brief The TQTSManip class is an internal helper class for the - TQTextStream. - - It is generally a very bad idea to use this class directly in - application programs. - - \internal - - This class makes it possible to give the TQTextStream function objects - with arguments, like this: - \code - TQTextStream cout( stdout, IO_WriteOnly ); - cout << setprecision( 8 ); // TQTSManip used here! - cout << 3.14159265358979323846; - \endcode - - The setprecision() function returns a TQTSManip object. - The TQTSManip object contains a pointer to a member function in - TQTextStream and an integer argument. - When serializing a TQTSManip into a TQTextStream, the function - is executed with the argument. -*/ - -/*! \fn TQTSManip::TQTSManip( TQTSMFI m, int a ) - - Constructs a TQTSManip object which will call \a m (a member function - in TQTextStream which accepts a single int) with argument \a a when - TQTSManip::exec() is called. Used internally in e.g. endl: - - \code - s << "some text" << endl << "more text"; - \endcode -*/ - -/*! \fn void TQTSManip::exec( TQTextStream& s ) - - Calls the member function specified in the constructor, for object - \a s. Used internally in e.g. endl: - - \code - s << "some text" << endl << "more text"; - \endcode -*/ - - -/***************************************************************************** - TQTextStream member functions - *****************************************************************************/ - -#if defined(QT_CHECK_STATE) -#undef CHECK_STREAM_PRECOND -#define CHECK_STREAM_PRECOND if ( !dev ) { \ - tqWarning( "TQTextStream: No device" ); \ - return *this; } -#else -#define CHECK_STREAM_PRECOND -#endif - - -#define I_SHORT 0x0010 -#define I_INT 0x0020 -#define I_LONG 0x0030 -#define I_LONGLONG 0x0040 -#define I_TYPE_MASK 0x00f0 - -#define I_BASE_2 TQTS::bin -#define I_BASE_8 TQTS::oct -#define I_BASE_10 TQTS::dec -#define I_BASE_16 TQTS::hex -#define I_BASE_MASK (TQTS::bin | TQTS::oct | TQTS::dec | TQTS::hex) - -#define I_SIGNED 0x0100 -#define I_UNSIGNED 0x0200 -#define I_SIGN_MASK 0x0f00 - - -static const TQChar TQEOF = TQChar((ushort)0xffff); //guaranteed not to be a character. -static const uint getline_buf_size = 256; // bufsize used by ts_getline() - -const int TQTextStream::basefield = I_BASE_MASK; -const int TQTextStream::adjustfield = ( TQTextStream::left | - TQTextStream::right | - TQTextStream::internal ); -const int TQTextStream::floatfield = ( TQTextStream::scientific | - TQTextStream::fixed ); - - -class TQTextStreamPrivate { -public: -#ifndef TQT_NO_TEXTCODEC - TQTextStreamPrivate() - : decoder( 0 ), encoder( 0 ), sourceType( NotSet ) { } - ~TQTextStreamPrivate() { - delete decoder; - delete encoder; - } - TQTextDecoder *decoder; - TQTextEncoder *encoder; -#else - TQTextStreamPrivate() : sourceType( NotSet ) { } - ~TQTextStreamPrivate() { } -#endif - TQString ungetcBuf; - - enum SourceType { NotSet, IODevice, String, ByteArray, File }; - SourceType sourceType; -}; - - -// skips whitespace and returns the first non-whitespace character -TQChar TQTextStream::eat_ws() -{ - TQChar c; - do { c = ts_getc(); } while ( c != TQEOF && ts_isspace(c) ); - return c; -} - -void TQTextStream::init() -{ - // ### ungetcBuf = TQEOF; - dev = 0; - owndev = FALSE; - mapper = 0; - d = new TQTextStreamPrivate; - doUnicodeHeader = TRUE; // autodetect - latin1 = TRUE; // should use locale? - internalOrder = TQChar::networkOrdered(); - networkOrder = TRUE; -} - -/*! - Constructs a data stream that has no IO device. -*/ - -TQTextStream::TQTextStream() -{ - init(); - setEncoding( Locale ); - reset(); - d->sourceType = TQTextStreamPrivate::NotSet; -} - -/*! - Constructs a text stream that uses the IO device \a iod. -*/ - -TQTextStream::TQTextStream( TQIODevice *iod ) -{ - init(); - setEncoding( Locale ); - dev = iod; - reset(); - d->sourceType = TQTextStreamPrivate::IODevice; -} - -// TODO: use special-case handling of this case in TQTextStream, and -// simplify this class to only deal with TQChar or TQString data. -class TQStringBuffer : public TQIODevice { -public: - TQStringBuffer( TQString* str ); - ~TQStringBuffer(); - bool open( int m ); - void close(); - void flush(); - Offset size() const; - Offset at() const; - bool at( Offset pos ); - TQ_LONG readBlock( char *p, TQ_ULONG len ); - TQ_LONG writeBlock( const char *p, TQ_ULONG len ); - int getch(); - int putch( int ch ); - int ungetch( int ch ); -protected: - TQString* s; - -private: - TQStringBuffer( const TQStringBuffer & ); - TQStringBuffer &operator=( const TQStringBuffer & ); -}; - - -TQStringBuffer::TQStringBuffer( TQString* str ) -{ - s = str; -} - -TQStringBuffer::~TQStringBuffer() -{ -} - - -bool TQStringBuffer::open( int m ) -{ - if ( !s ) { -#if defined(QT_CHECK_STATE) - tqWarning( "TQStringBuffer::open: No string" ); -#endif - return FALSE; - } - if ( isOpen() ) { -#if defined(QT_CHECK_STATE) - tqWarning( "TQStringBuffer::open: Buffer already open" ); -#endif - return FALSE; - } - setMode( m ); - if ( m & IO_Truncate ) - s->truncate( 0 ); - - if ( m & IO_Append ) { - ioIndex = s->length()*sizeof(TQChar); - } else { - ioIndex = 0; - } - setState( IO_Open ); - resetStatus(); - return TRUE; -} - -void TQStringBuffer::close() -{ - if ( isOpen() ) { - setFlags( IO_Direct ); - ioIndex = 0; - } -} - -void TQStringBuffer::flush() -{ -} - -TQIODevice::Offset TQStringBuffer::size() const -{ - return s ? s->length()*sizeof(TQChar) : 0; -} - -TQIODevice::Offset TQStringBuffer::at() const -{ - return ioIndex; -} - -bool TQStringBuffer::at( Offset pos ) -{ -#if defined(QT_CHECK_STATE) - if ( !isOpen() ) { - tqWarning( "TQStringBuffer::at: Buffer is not open" ); - return FALSE; - } -#endif - if ( pos >= s->length()*2 ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQStringBuffer::at: Index %lu out of range", pos ); -#endif - return FALSE; - } - ioIndex = pos; - return TRUE; -} - - -TQ_LONG TQStringBuffer::readBlock( char *p, TQ_ULONG len ) -{ -#if defined(QT_CHECK_STATE) - TQ_CHECK_PTR( p ); - if ( !isOpen() ) { - tqWarning( "TQStringBuffer::readBlock: Buffer not open" ); - return -1; - } - if ( !isReadable() ) { - tqWarning( "TQStringBuffer::readBlock: Read operation not permitted" ); - return -1; - } -#endif - if ( ioIndex + len > s->length()*sizeof(TQChar) ) { - // overflow - if ( (uint)ioIndex >= s->length()*sizeof(TQChar) ) { - setStatus( IO_ReadError ); - return -1; - } else { - len = s->length()*2 - (uint)ioIndex; - } - } - memcpy( p, ((const char*)(s->unicode()))+ioIndex, len ); - ioIndex += len; - return len; -} - -TQ_LONG TQStringBuffer::writeBlock( const char *p, TQ_ULONG len ) -{ -#if defined(QT_CHECK_NULL) - if ( p == 0 && len != 0 ) - tqWarning( "TQStringBuffer::writeBlock: Null pointer error" ); -#endif -#if defined(QT_CHECK_STATE) - if ( !isOpen() ) { - tqWarning( "TQStringBuffer::writeBlock: Buffer not open" ); - return -1; - } - if ( !isWritable() ) { - tqWarning( "TQStringBuffer::writeBlock: Write operation not permitted" ); - return -1; - } - if ( ioIndex&1 ) { - tqWarning( "TQStringBuffer::writeBlock: non-even index - non Unicode" ); - return -1; - } - if ( len&1 ) { - tqWarning( "TQStringBuffer::writeBlock: non-even length - non Unicode" ); - return -1; - } -#endif - s->replace(ioIndex/2, len/2, (TQChar*)p, len/2); - ioIndex += len; - return len; -} - -int TQStringBuffer::getch() -{ -#if defined(QT_CHECK_STATE) - if ( !isOpen() ) { - tqWarning( "TQStringBuffer::getch: Buffer not open" ); - return -1; - } - if ( !isReadable() ) { - tqWarning( "TQStringBuffer::getch: Read operation not permitted" ); - return -1; - } -#endif - if ( (uint)ioIndex >= s->length()*2 ) { // overflow - setStatus( IO_ReadError ); - return -1; - } - return (int)((const uchar *)s->unicode())[ioIndex++]; -} - -int TQStringBuffer::putch( int ch ) -{ - char c = ch; - if ( writeBlock(&c,1) < 0 ) - return -1; - else - return ch; -} - -int TQStringBuffer::ungetch( int ch ) -{ -#if defined(QT_CHECK_STATE) - if ( !isOpen() ) { - tqWarning( "TQStringBuffer::ungetch: Buffer not open" ); - return -1; - } - if ( !isReadable() ) { - tqWarning( "TQStringBuffer::ungetch: Read operation not permitted" ); - return -1; - } -#endif - if ( ch != -1 ) { // something to do with eof - if ( ioIndex ) - ioIndex--; - else - ch = -1; - } - return ch; -} - - -/*! - Constructs a text stream that operates on the Unicode TQString, \a - str, through an internal device. The \a filemode argument is - passed to the device's open() function; see \l{TQIODevice::mode()}. - - If you set an encoding or codec with setEncoding() or setCodec(), - this setting is ignored for text streams that operate on TQString. - - Example: - \code - TQString str; - TQTextStream ts( &str, IO_WriteOnly ); - ts << "pi = " << 3.14; // str == "pi = 3.14" - \endcode - - Writing data to the text stream will modify the contents of the - string. The string will be expanded when data is written beyond - the end of the string. Note that the string will not be truncated: - \code - TQString str = "pi = 3.14"; - TQTextStream ts( &str, IO_WriteOnly ); - ts << "2+2 = " << 2+2; // str == "2+2 = 414" - \endcode - - Note that because TQString is Unicode, you should not use - readRawBytes() or writeRawBytes() on such a stream. -*/ - -TQTextStream::TQTextStream( TQString* str, int filemode ) -{ - // TODO: optimize for this case as it becomes more common - // (see TQStringBuffer above) - init(); - dev = new TQStringBuffer( str ); - ((TQStringBuffer *)dev)->open( filemode ); - owndev = TRUE; - setEncoding(RawUnicode); - reset(); - d->sourceType = TQTextStreamPrivate::String; -} - -/*! \obsolete - - This constructor is equivalent to the constructor taking a TQString* - parameter. -*/ - -TQTextStream::TQTextStream( TQString& str, int filemode ) -{ - init(); - dev = new TQStringBuffer( &str ); - ((TQStringBuffer *)dev)->open( filemode ); - owndev = TRUE; - setEncoding(RawUnicode); - reset(); - d->sourceType = TQTextStreamPrivate::String; -} - -/*! - Constructs a text stream that operates on the byte array, \a a, - through an internal TQBuffer device. The \a mode argument is passed - to the device's open() function; see \l{TQIODevice::mode()}. - - Example: - \code - TQByteArray array; - TQTextStream ts( array, IO_WriteOnly ); - ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14" - \endcode - - Writing data to the text stream will modify the contents of the - array. The array will be expanded when data is written beyond the - end of the string. - - Same example, using a TQBuffer: - \code - TQByteArray array; - TQBuffer buf( array ); - buf.open( IO_WriteOnly ); - TQTextStream ts( &buf ); - ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14" - buf.close(); - \endcode -*/ - -TQTextStream::TQTextStream( TQByteArray a, int mode ) -{ - init(); - dev = new TQBuffer( a ); - ((TQBuffer *)dev)->open( mode ); - owndev = TRUE; - setEncoding( Latin1 ); //### Locale??? - reset(); - d->sourceType = TQTextStreamPrivate::ByteArray; -} - -/*! - Constructs a text stream that operates on an existing file handle - \a fh through an internal TQFile device. The \a mode argument is - passed to the device's open() function; see \l{TQIODevice::mode()}. - - Note that if you create a TQTextStream \c cout or another name that - is also used for another variable of a different type, some - linkers may confuse the two variables, which will often cause - crashes. -*/ - -TQTextStream::TQTextStream( FILE *fh, int mode ) -{ - init(); - setEncoding( Locale ); //### - dev = new TQFile; - ((TQFile *)dev)->open( mode, fh ); - owndev = TRUE; - reset(); - d->sourceType = TQTextStreamPrivate::File; -} - -/*! - Destroys the text stream. - - The destructor does not affect the current IO device. -*/ - -TQTextStream::~TQTextStream() -{ - if ( owndev ) - delete dev; - delete d; -} - -/*! - Positions the read pointer at the first non-whitespace character. -*/ -void TQTextStream::skipWhiteSpace() -{ - ts_ungetc( eat_ws() ); -} - - -/*! - Tries to read \a len characters from the stream and stores them in - \a buf. Returns the number of characters really read. - - \warning There will no TQEOF appended if the read reaches the end - of the file. EOF is reached when the return value does not equal - \a len. -*/ -uint TQTextStream::ts_getbuf( TQChar* buf, uint len ) -{ - if ( len < 1 ) - return 0; - - uint rnum = 0; // the number of TQChars really read - - if ( d && d->ungetcBuf.length() ) { - while ( rnum < len && rnum < d->ungetcBuf.length() ) { - *buf = d->ungetcBuf.constref( rnum ); - buf++; - rnum++; - } - d->ungetcBuf = d->ungetcBuf.mid( rnum ); - if ( rnum >= len ) - return rnum; - } - - // we use dev->ungetch() for one of the bytes of the unicode - // byte-order mark, but a local unget hack for the other byte: - int ungetHack = EOF; - - if ( doUnicodeHeader ) { - doUnicodeHeader = FALSE; // only at the top - int c1 = dev->getch(); - if ( c1 == EOF ) - return rnum; - int c2 = dev->getch(); - if ( c1 == 0xfe && c2 == 0xff ) { - mapper = 0; - latin1 = FALSE; - internalOrder = TQChar::networkOrdered(); - networkOrder = TRUE; - } else if ( c1 == 0xff && c2 == 0xfe ) { - mapper = 0; - latin1 = FALSE; - internalOrder = !TQChar::networkOrdered(); - networkOrder = FALSE; - } else { - if ( c2 != EOF ) { - dev->ungetch( c2 ); - ungetHack = c1; - } else { - /* - A small bug might hide here. If only the first byte - of a file has made it so far, and that first byte - is half of the byte-order mark, then the utfness - will not be detected. - */ - dev->ungetch( c1 ); - } - } - } - -#ifndef TQT_NO_TEXTCODEC - if ( mapper ) { - bool shortRead = FALSE; - if ( !d->decoder ) - d->decoder = mapper->makeDecoder(); - while( rnum < len ) { - TQString s; - bool readBlock = !( len == 1+rnum ); - for (;;) { - // for efficiency: normally read a whole block - if ( readBlock ) { - // guess buffersize; this may be wrong (too small or too - // big). But we can handle this (either iterate reading - // or use ungetcBuf). - // Note that this might cause problems for codecs where - // one byte can result in >1 Unicode Characters if bytes - // are written to the stream in the meantime (loss of - // synchronicity). - uint rlen = len - rnum; - char *cbuf = new char[ rlen ]; - if ( ungetHack != EOF ) { - rlen = 1+dev->readBlock( cbuf+1, rlen-1 ); - cbuf[0] = (char)ungetHack; - ungetHack = EOF; - } else { - rlen = dev->readBlock( cbuf, rlen ); - } - s += d->decoder->toUnicode( cbuf, rlen ); - delete[] cbuf; - // use buffered reading only for the first time, because we - // have to get the stream synchronous again (this is easier - // with single character reading) - readBlock = FALSE; - } - // get stream (and codec) in sync - int c; - if ( ungetHack == EOF ) { - c = dev->getch(); - } else { - c = ungetHack; - ungetHack = EOF; - } - if ( c == EOF ) { - shortRead = TRUE; - break; - } - char b = c; - uint lengthBefore = s.length(); - s += d->decoder->toUnicode( &b, 1 ); - if ( s.length() > lengthBefore ) - break; // it seems we are in sync now - } - uint i = 0; - uint end = TQMIN( len-rnum, s.length() ); - while( i < end ) { - *buf = s.constref(i++); - buf++; - } - rnum += end; - if ( s.length() > i ) { - // could be = but append is clearer - d->ungetcBuf.append( s.mid( i ) ); - } - if ( shortRead ) - return rnum; - } - } else -#endif - if ( latin1 ) { - if ( len == 1+rnum ) { - // use this method for one character because it is more efficient - // (arnt doubts whether it makes a difference, but lets it stand) - int c = (ungetHack == EOF) ? dev->getch() : ungetHack; - if ( c != EOF ) { - *buf = (char)c; - buf++; - rnum++; - } - } else { - if ( ungetHack != EOF ) { - *buf = (char)ungetHack; - buf++; - rnum++; - ungetHack = EOF; - } - char *cbuf = new char[len - rnum]; - while ( !dev->atEnd() && rnum < len ) { - uint rlen = len - rnum; - rlen = dev->readBlock( cbuf, rlen ); - char *it = cbuf; - char *end = cbuf + rlen; - while ( it < end ) { - *buf = *it; - buf++; - it++; - } - rnum += rlen; - } - delete[] cbuf; - } - } else { // UCS-2 or UTF-16 - if ( len == 1+rnum ) { - int c1 = (ungetHack == EOF) ? dev->getch() : ungetHack; - if ( c1 == EOF ) - return rnum; - int c2 = dev->getch(); - if ( c2 == EOF ) - return rnum; - - if ( networkOrder ) { - *buf = TQChar( c2, c1 ); - } else { - *buf = TQChar( c1, c2 ); - } - buf++; - rnum++; - } else { - char *cbuf = new char[ 2*( len - rnum ) ]; // for paranoids: overflow possible - while ( !dev->atEnd() && rnum < len ) { - uint rlen = 2 * ( len-rnum ); - if ( ungetHack != EOF ) { - rlen = 1+dev->readBlock( cbuf+1, rlen-1 ); - cbuf[0] = (char)ungetHack; - ungetHack = EOF; - } else { - rlen = dev->readBlock( cbuf, rlen ); - } - // We can't use an odd number of bytes, so put it back. But - // do it only if we are capable of reading more -- normally - // there should not be an odd number, but the file might be - // truncated or not in UTF-16... - if ( (rlen & 1) == 1 ) - if ( !dev->atEnd() ) - dev->ungetch( cbuf[--rlen] ); - uint i = 0; - if ( networkOrder ) { - while( i < rlen ) { - *buf = TQChar( cbuf[i+1], cbuf[i] ); - buf++; - i+=2; - } - } else { - while( i < rlen ) { - *buf = TQChar( cbuf[i], cbuf[i+1] ); - buf++; - i+=2; - } - } - rnum += i/2; - } - delete[] cbuf; - } - } - return rnum; -} - -/*! - Tries to read one line, but at most len characters from the stream - and stores them in \a buf. - - Returns the number of characters really read. Newlines are not - stripped. - - There will be a TQEOF appended if the read reaches the end of file; - this is different to ts_getbuf(). - - This function works only if a newline (as byte) is also a newline - (as resulting character) since it uses TQIODevice::readLine(). So - use it only for such codecs where this is true! - - This function is (almost) a no-op for UTF 16. Don't use it if - doUnicodeHeader is TRUE! -*/ -uint TQTextStream::ts_getline( TQChar* buf ) -{ - uint rnum=0; // the number of TQChars really read - char cbuf[ getline_buf_size+1 ]; - - if ( d && d->ungetcBuf.length() ) { - while( rnum < getline_buf_size && rnum < d->ungetcBuf.length() ) { - buf[rnum] = d->ungetcBuf.constref(rnum); - rnum++; - } - d->ungetcBuf = d->ungetcBuf.mid( rnum ); - if ( rnum >= getline_buf_size ) - return rnum; - } - -#ifndef TQT_NO_TEXTCODEC - if ( mapper ) { - if ( !d->decoder ) - d->decoder = mapper->makeDecoder(); - TQString s; - bool readBlock = TRUE; - for (;;) { - // for efficiency: try to read a line - if ( readBlock ) { - int rlen = getline_buf_size - rnum; - rlen = dev->readLine( cbuf, rlen+1 ); - if ( rlen == -1 ) - rlen = 0; - s += d->decoder->toUnicode( cbuf, rlen ); - readBlock = FALSE; - } - if ( dev->atEnd() - || s.at( s.length()-1 ) == '\n' - || s.at( s.length()-1 ) == '\r' - ) { - break; - } else { - // get stream (and codec) in sync - int c; - c = dev->getch(); - if ( c == EOF ) { - break; - } - char b = c; - uint lengthBefore = s.length(); - s += d->decoder->toUnicode( &b, 1 ); - if ( s.length() > lengthBefore ) - break; // it seems we are in sync now - } - } - uint i = 0; - while( rnum < getline_buf_size && i < s.length() ) - buf[rnum++] = s.constref(i++); - if ( s.length() > i ) - // could be = but append is clearer - d->ungetcBuf.append( s.mid( i ) ); - if ( rnum < getline_buf_size && dev->atEnd() ) - buf[rnum++] = TQEOF; - } else -#endif - if ( latin1 ) { - int rlen = getline_buf_size - rnum; - rlen = dev->readLine( cbuf, rlen+1 ); - if ( rlen == -1 ) - rlen = 0; - char *end = cbuf+rlen; - char *it = cbuf; - buf +=rnum; - while ( it != end ) { - buf->setCell( *(it++) ); - buf->setRow( 0 ); - buf++; - } - rnum += rlen; - if ( rnum < getline_buf_size && dev->atEnd() ) - buf[1] = TQEOF; - } - return rnum; -} - - -/*! - Puts one character into the stream. -*/ -void TQTextStream::ts_putc( TQChar c ) -{ -#ifndef TQT_NO_TEXTCODEC - if ( mapper ) { - if ( !d->encoder ) - d->encoder = mapper->makeEncoder(); - int len = 1; - TQString s = c; - TQCString block = d->encoder->fromUnicode( s, len ); - dev->writeBlock( block, len ); - } else -#endif - if ( latin1 ) { - if ( c.row() ) - dev->putch( '?' ); // unknown character - else - dev->putch( c.cell() ); - } else { - if ( doUnicodeHeader ) { - doUnicodeHeader = FALSE; - ts_putc( TQChar::byteOrderMark ); - } - if ( internalOrder ) { - // this case is needed by TQStringBuffer - dev->writeBlock( (char*)&c, sizeof(TQChar) ); - } else if ( networkOrder ) { - dev->putch( c.row() ); - dev->putch( c.cell() ); - } else { - dev->putch( c.cell() ); - dev->putch( c.row() ); - } - } -} - -/*! - Puts one character into the stream. -*/ -void TQTextStream::ts_putc( int ch ) -{ - ts_putc( TQChar((ushort)ch) ); -} - -bool TQTextStream::ts_isdigit( TQChar c ) -{ - return c.isDigit(); -} - -bool TQTextStream::ts_isspace( TQChar c ) -{ - return c.isSpace(); -} - -void TQTextStream::ts_ungetc( TQChar c ) -{ - if ( c.unicode() == 0xffff ) - return; - - d->ungetcBuf.prepend( c ); -} - - - -/*! - Reads \a len bytes from the stream into \a s and returns a - reference to the stream. - - The buffer \a s must be preallocated. - - Note that no encoding is done by this function. - - \warning The behavior of this function is undefined unless the - stream's encoding is set to Unicode or Latin1. - - \sa TQIODevice::readBlock() -*/ - -TQTextStream &TQTextStream::readRawBytes( char *s, uint len ) -{ - dev->readBlock( s, len ); - return *this; -} - -/*! - Writes the \a len bytes from \a s to the stream and returns a - reference to the stream. - - Note that no encoding is done by this function. - - \sa TQIODevice::writeBlock() -*/ - -TQTextStream &TQTextStream::writeRawBytes( const char* s, uint len ) -{ - dev->writeBlock( s, len ); - return *this; -} - - -TQTextStream &TQTextStream::writeBlock( const char* p, uint len ) -{ - if ( doUnicodeHeader ) { - doUnicodeHeader = FALSE; - if ( !mapper && !latin1 ) - ts_putc( TQChar::byteOrderMark ); - } - // TQCString and const char * are treated as Latin-1 - if ( !mapper && latin1 ) { - dev->writeBlock( p, len ); - } else if ( !mapper && internalOrder ) { - TQChar *u = new TQChar[len]; - for ( uint i = 0; i < len; i++ ) - u[i] = p[i]; - dev->writeBlock( (char*)u, len * sizeof(TQChar) ); - delete [] u; - } -#ifndef TQT_NO_TEXTCODEC - else if (mapper) { - if (!d->encoder) - d->encoder = mapper->makeEncoder(); - TQString s = TQString::fromLatin1(p, len); - int l = len; - TQCString block = d->encoder->fromUnicode(s, l); - dev->writeBlock(block, l); - } -#endif - else { - for ( uint i = 0; i < len; i++ ) - ts_putc( (uchar)p[i] ); - } - return *this; -} - -TQTextStream &TQTextStream::writeBlock( const TQChar* p, uint len ) -{ -#ifndef TQT_NO_TEXTCODEC - if ( mapper ) { - if ( !d->encoder ) - d->encoder = mapper->makeEncoder(); - TQConstString s( p, len ); - int l = len; - TQCString block = d->encoder->fromUnicode( s.string(), l ); - dev->writeBlock( block, l ); - } else -#endif - if ( latin1 ) { - char *str = TQString::unicodeToLatin1( p, len ); - dev->writeBlock( str, len ); - delete [] str; - } else if ( internalOrder ) { - if ( doUnicodeHeader ) { - doUnicodeHeader = FALSE; - ts_putc( TQChar::byteOrderMark ); - } - dev->writeBlock( (char*)p, sizeof(TQChar)*len ); - } else { - for (uint i=0; i<len; i++) - ts_putc( p[i] ); - } - return *this; -} - -/*! - Resets the text stream. - - \list - \i All flags are set to 0. - \i The field width is set to 0. - \i The fill character is set to ' ' (Space). - \i The precision is set to 6. - \endlist - - \sa setf(), width(), fill(), precision() -*/ - -void TQTextStream::reset() -{ - fflags = 0; - fwidth = 0; - fillchar = ' '; - fprec = 6; -} - -/*! - \fn TQIODevice *TQTextStream::device() const - - Returns the IO device currently set. - - \sa setDevice(), unsetDevice() -*/ - -/*! - Sets the IO device to \a iod. - - \sa device(), unsetDevice() -*/ - -void TQTextStream::setDevice( TQIODevice *iod ) -{ - if ( owndev ) { - delete dev; - owndev = FALSE; - } - dev = iod; - d->sourceType = TQTextStreamPrivate::IODevice; -} - -/*! - Unsets the IO device. Equivalent to setDevice( 0 ). - - \sa device(), setDevice() -*/ - -void TQTextStream::unsetDevice() -{ - setDevice( 0 ); - d->sourceType = TQTextStreamPrivate::NotSet; -} - -/*! - \fn bool TQTextStream::atEnd() const - - Returns TRUE if the IO device has reached the end position (end of - the stream or file) or if there is no IO device set; otherwise - returns FALSE. - - \sa TQIODevice::atEnd() -*/ - -/*!\fn bool TQTextStream::eof() const - - \obsolete - - This function has been renamed to atEnd(). - - \sa TQIODevice::atEnd() -*/ - -/***************************************************************************** - TQTextStream read functions - *****************************************************************************/ - - -/*! - \overload - - Reads a char \a c from the stream and returns a reference to the - stream. Note that whitespace is skipped. -*/ - -TQTextStream &TQTextStream::operator>>( char &c ) -{ - CHECK_STREAM_PRECOND - c = eat_ws(); - return *this; -} - -/*! - Reads a char \a c from the stream and returns a reference to the - stream. Note that whitespace is \e not skipped. -*/ - -TQTextStream &TQTextStream::operator>>( TQChar &c ) -{ - CHECK_STREAM_PRECOND - c = ts_getc(); - return *this; -} - - -ulong TQTextStream::input_bin() -{ - ulong val = 0; - TQChar ch = eat_ws(); - int dv = ch.digitValue(); - while ( dv == 0 || dv == 1 ) { - val = ( val << 1 ) + dv; - ch = ts_getc(); - dv = ch.digitValue(); - } - if ( ch != TQEOF ) - ts_ungetc( ch ); - return val; -} - -ulong TQTextStream::input_oct() -{ - ulong val = 0; - TQChar ch = eat_ws(); - int dv = ch.digitValue(); - while ( dv >= 0 && dv <= 7 ) { - val = ( val << 3 ) + dv; - ch = ts_getc(); - dv = ch.digitValue(); - } - if ( dv == 8 || dv == 9 ) { - while ( ts_isdigit(ch) ) - ch = ts_getc(); - } - if ( ch != TQEOF ) - ts_ungetc( ch ); - return val; -} - -ulong TQTextStream::input_dec() -{ - ulong val = 0; - TQChar ch = eat_ws(); - int dv = ch.digitValue(); - while ( ts_isdigit(ch) ) { - val = val * 10 + dv; - ch = ts_getc(); - dv = ch.digitValue(); - } - if ( ch != TQEOF ) - ts_ungetc( ch ); - return val; -} - -ulong TQTextStream::input_hex() -{ - ulong val = 0; - TQChar ch = eat_ws(); - char c = ch; - while ( isxdigit((uchar) c) ) { - val <<= 4; - if ( ts_isdigit(c) ) - val += c - '0'; - else - val += 10 + tolower( (uchar) c ) - 'a'; - c = ch = ts_getc(); - } - if ( ch != TQEOF ) - ts_ungetc( ch ); - return val; -} - -long TQTextStream::input_int() -{ - long val; - TQChar ch; - char c; - switch ( flags() & basefield ) { - case bin: - val = (long)input_bin(); - break; - case oct: - val = (long)input_oct(); - break; - case dec: - c = ch = eat_ws(); - if ( ch == TQEOF ) { - val = 0; - } else { - if ( !(c == '-' || c == '+') ) - ts_ungetc( ch ); - if ( c == '-' ) { - ulong v = input_dec(); - if ( v ) { // ensure that LONG_MIN can be read - v--; - val = -((long)v) - 1; - } else { - val = 0; - } - } else { - val = (long)input_dec(); - } - } - break; - case hex: - val = (long)input_hex(); - break; - default: - val = 0; - c = ch = eat_ws(); - if ( c == '0' ) { // bin, oct or hex - c = ch = ts_getc(); - if ( tolower((uchar) c) == 'x' ) - val = (long)input_hex(); - else if ( tolower((uchar) c) == 'b' ) - val = (long)input_bin(); - else { // octal - ts_ungetc( ch ); - if ( c >= '0' && c <= '7' ) { - val = (long)input_oct(); - } else { - val = 0; - } - } - } else if ( ts_isdigit(ch) ) { - ts_ungetc( ch ); - val = (long)input_dec(); - } else if ( c == '-' || c == '+' ) { - ulong v = input_dec(); - if ( c == '-' ) { - if ( v ) { // ensure that LONG_MIN can be read - v--; - val = -((long)v) - 1; - } else { - val = 0; - } - } else { - val = (long)v; - } - } - } - return val; -} - -// -// We use a table-driven FSM to parse floating point numbers -// strtod() cannot be used directly since we're reading from a TQIODevice -// - -double TQTextStream::input_double() -{ - const int Init = 0; // states - const int Sign = 1; - const int Mantissa = 2; - const int Dot = 3; - const int Abscissa = 4; - const int ExpMark = 5; - const int ExpSign = 6; - const int Exponent = 7; - const int Done = 8; - - const int InputSign = 1; // input tokens - const int InputDigit = 2; - const int InputDot = 3; - const int InputExp = 4; - - static const uchar table[8][5] = { - /* None InputSign InputDigit InputDot InputExp */ - { 0, Sign, Mantissa, Dot, 0, }, // Init - { 0, 0, Mantissa, Dot, 0, }, // Sign - { Done, Done, Mantissa, Dot, ExpMark,}, // Mantissa - { 0, 0, Abscissa, 0, 0, }, // Dot - { Done, Done, Abscissa, Done, ExpMark,}, // Abscissa - { 0, ExpSign, Exponent, 0, 0, }, // ExpMark - { 0, 0, Exponent, 0, 0, }, // ExpSign - { Done, Done, Exponent, Done, Done } // Exponent - }; - - int state = Init; // parse state - int input; // input token - - char buf[256]; - int i = 0; - TQChar c = eat_ws(); - - for (;;) { - - switch ( c ) { - case '+': - case '-': - input = InputSign; - break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - input = InputDigit; - break; - case '.': - input = InputDot; - break; - case 'e': - case 'E': - input = InputExp; - break; - default: - input = 0; - break; - } - - state = table[state][input]; - - if ( state == 0 || state == Done || i > 250 ) { - if ( i > 250 ) { // ignore rest of digits - do { c = ts_getc(); } while ( c != TQEOF && ts_isdigit(c) ); - } - if ( c != TQEOF ) - ts_ungetc( c ); - buf[i] = '\0'; - char *end; - return strtod( buf, &end ); - } - - buf[i++] = c; - c = ts_getc(); - } - -#if !defined(Q_CC_EDG) - return 0.0; -#endif -} - - -/*! - \overload - - Reads a signed \c short integer \a i from the stream and returns a - reference to the stream. See flags() for an explanation of the - expected input format. -*/ - -TQTextStream &TQTextStream::operator>>( signed short &i ) -{ - CHECK_STREAM_PRECOND - i = (signed short)input_int(); - return *this; -} - - -/*! - \overload - - Reads an unsigned \c short integer \a i from the stream and - returns a reference to the stream. See flags() for an explanation - of the expected input format. -*/ - -TQTextStream &TQTextStream::operator>>( unsigned short &i ) -{ - CHECK_STREAM_PRECOND - i = (unsigned short)input_int(); - return *this; -} - - -/*! - \overload - - Reads a signed \c int \a i from the stream and returns a reference - to the stream. See flags() for an explanation of the expected - input format. -*/ - -TQTextStream &TQTextStream::operator>>( signed int &i ) -{ - CHECK_STREAM_PRECOND - i = (signed int)input_int(); - return *this; -} - - -/*! - \overload - - Reads an unsigned \c int \a i from the stream and returns a - reference to the stream. See flags() for an explanation of the - expected input format. -*/ - -TQTextStream &TQTextStream::operator>>( unsigned int &i ) -{ - CHECK_STREAM_PRECOND - i = (unsigned int)input_int(); - return *this; -} - - -/*! - \overload - - Reads a signed \c long int \a i from the stream and returns a - reference to the stream. See flags() for an explanation of the - expected input format. -*/ - -TQTextStream &TQTextStream::operator>>( signed long &i ) -{ - CHECK_STREAM_PRECOND - i = (signed long)input_int(); - return *this; -} - - -/*! - \overload - - Reads an unsigned \c long int \a i from the stream and returns a - reference to the stream. See flags() for an explanation of the - expected input format. -*/ - -TQTextStream &TQTextStream::operator>>( unsigned long &i ) -{ - CHECK_STREAM_PRECOND - i = (unsigned long)input_int(); - return *this; -} - - -/*! - \overload - - Reads a \c float \a f from the stream and returns a reference to - the stream. See flags() for an explanation of the expected input - format. -*/ - -TQTextStream &TQTextStream::operator>>( float &f ) -{ - CHECK_STREAM_PRECOND - f = (float)input_double(); - return *this; -} - - -/*! - \overload - - Reads a \c double \a f from the stream and returns a reference to - the stream. See flags() for an explanation of the expected input - format. -*/ - -TQTextStream &TQTextStream::operator>>( double &f ) -{ - CHECK_STREAM_PRECOND - f = input_double(); - return *this; -} - - -/*! - \overload - - Reads a "word" from the stream into \a s and returns a reference - to the stream. - - A word consists of characters for which isspace() returns FALSE. -*/ - -TQTextStream &TQTextStream::operator>>( char *s ) -{ - CHECK_STREAM_PRECOND - int maxlen = width( 0 ); - TQChar c = eat_ws(); - if ( !maxlen ) - maxlen = -1; - while ( c != TQEOF ) { - if ( ts_isspace(c) || maxlen-- == 0 ) { - ts_ungetc( c ); - break; - } - *s++ = c; - c = ts_getc(); - } - - *s = '\0'; - return *this; -} - -/*! - \overload - - Reads a "word" from the stream into \a str and returns a reference - to the stream. - - A word consists of characters for which isspace() returns FALSE. -*/ - -TQTextStream &TQTextStream::operator>>( TQString &str ) -{ - CHECK_STREAM_PRECOND - str=TQString::fromLatin1(""); - TQChar c = eat_ws(); - - while ( c != TQEOF ) { - if ( ts_isspace(c) ) { - ts_ungetc( c ); - break; - } - str += c; - c = ts_getc(); - } - return *this; -} - -/*! - \overload - - Reads a "word" from the stream into \a str and returns a reference - to the stream. - - A word consists of characters for which isspace() returns FALSE. -*/ - -TQTextStream &TQTextStream::operator>>( TQCString &str ) -{ - CHECK_STREAM_PRECOND - TQCString *dynbuf = 0; - const int buflen = 256; - char buffer[buflen]; - char *s = buffer; - int i = 0; - TQChar c = eat_ws(); - - while ( c != TQEOF ) { - if ( ts_isspace(c) ) { - ts_ungetc( c ); - break; - } - if ( i >= buflen-1 ) { - if ( !dynbuf ) { // create dynamic buffer - dynbuf = new TQCString(buflen*2); - memcpy( dynbuf->data(), s, i ); // copy old data - } else if ( i >= (int)dynbuf->size()-1 ) { - dynbuf->resize( dynbuf->size()*2 ); - } - s = dynbuf->data(); - } - s[i++] = c; - c = ts_getc(); - } - str.resize( i+1 ); - memcpy( str.data(), s, i ); - delete dynbuf; - return *this; -} - - -/*! - Reads a line from the stream and returns a string containing the - text. - - The returned string does not contain any trailing newline or - carriage return. Note that this is different from - TQIODevice::readLine(), which does not strip the newline at the end - of the line. - - On EOF you will get a TQString that is null. On reading an empty - line the returned TQString is empty but not null. - - \sa TQIODevice::readLine() -*/ - -TQString TQTextStream::readLine() -{ -#if defined(QT_CHECK_STATE) - if ( !dev ) { - tqWarning( "TQTextStream::readLine: No device" ); - return TQString::null; - } -#endif - bool readCharByChar = TRUE; - TQString result; -#if 0 - if ( !doUnicodeHeader && ( - (latin1) || - (mapper != 0 && mapper->mibEnum() == 106 ) // UTF 8 - ) ) { - readCharByChar = FALSE; - // use optimized read line - TQChar c[getline_buf_size]; - int pos = 0; - bool eof = FALSE; - - for (;;) { - pos = ts_getline( c ); - if ( pos == 0 ) { - // something went wrong; try fallback - readCharByChar = TRUE; - //dev->resetStatus(); - break; - } - if ( c[pos-1] == TQEOF || c[pos-1] == '\n' ) { - if ( pos>2 && c[pos-1]==TQEOF && c[pos-2]=='\n' ) { - result += TQString( c, pos-2 ); - } else if ( pos > 1 ) { - result += TQString( c, pos-1 ); - } - if ( pos == 1 && c[pos-1] == TQEOF ) - eof = TRUE; - break; - } else { - result += TQString( c, pos ); - } - } - if ( eof && result.isEmpty() ) - return TQString::null; - } -#endif - if ( readCharByChar ) { - const int buf_size = 256; - TQChar c[buf_size]; - int pos = 0; - - c[pos] = ts_getc(); - if ( c[pos] == TQEOF ) - return TQString::null; - - while ( c[pos] != TQEOF && c[pos] != '\n' ) { - if ( c[pos] == '\r' ) { // ( handle mac and dos ) - TQChar nextc = ts_getc(); - if ( nextc != '\n' ) - ts_ungetc( nextc ); - break; - } - pos++; - if ( pos >= buf_size ) { - result += TQString( c, pos ); - pos = 0; - } - c[pos] = ts_getc(); - } - result += TQString( c, pos ); - } - - return result; -} - - -/*! - Reads the entire stream from the current position, and returns a string - containing the text. - - \sa TQIODevice::readLine() -*/ - -TQString TQTextStream::read() -{ -#if defined(QT_CHECK_STATE) - if ( !dev ) { - tqWarning( "TQTextStream::read: No device" ); - return TQString::null; - } -#endif - TQString result; - const uint bufsize = 512; - TQChar buf[bufsize]; - uint i, num, start; - bool skipped_cr = FALSE; - - for (;;) { - num = ts_getbuf(buf,bufsize); - // convert dos (\r\n) and mac (\r) style eol to unix style (\n) - start = 0; - for ( i=0; i<num; i++ ) { - if ( buf[i] == '\r' ) { - // Only skip single cr's preceding lf's - if ( skipped_cr ) { - result += buf[i]; - start++; - } else { - result += TQString( &buf[start], i-start ); - start = i+1; - skipped_cr = TRUE; - } - } else { - if ( skipped_cr ) { - if ( buf[i] != '\n' ) { - // Should not have skipped it - result += '\n'; - } - skipped_cr = FALSE; - } - } - } - if ( start < num ) - result += TQString( &buf[start], i-start ); - if ( num != bufsize ) // if ( EOF ) - break; - } - return result; -} - - - -/***************************************************************************** - TQTextStream write functions - *****************************************************************************/ - -/*! - Writes character \c char to the stream and returns a reference to - the stream. - - The character \a c is assumed to be Latin1 encoded independent of - the Encoding set for the TQTextStream. -*/ -TQTextStream &TQTextStream::operator<<( TQChar c ) -{ - CHECK_STREAM_PRECOND - ts_putc( c ); - return *this; -} - -/*! - \overload - - Writes character \a c to the stream and returns a reference to the - stream. -*/ -TQTextStream &TQTextStream::operator<<( char c ) -{ - CHECK_STREAM_PRECOND - unsigned char uc = (unsigned char) c; - ts_putc( uc ); - return *this; -} - -TQTextStream &TQTextStream::output_int( int format, unsigned long long n, bool neg ) -{ - static const char hexdigits_lower[] = "0123456789abcdef"; - static const char hexdigits_upper[] = "0123456789ABCDEF"; - CHECK_STREAM_PRECOND - char buf[76]; - char *p; - int len; - const char *hexdigits; - - switch ( flags() & I_BASE_MASK ) { - - case I_BASE_2: // output binary number - switch ( format & I_TYPE_MASK ) { - case I_SHORT: len=16; break; - case I_INT: len=sizeof(int)*8; break; - case I_LONG: len=32; break; - case I_LONGLONG: len=64; break; - default: len = 0; - } - p = &buf[74]; // go reverse order - *p = '\0'; - while ( len-- ) { - *--p = (char)(n&1) + '0'; - n >>= 1; - if ( !n ) - break; - } - if ( flags() & showbase ) { // show base - *--p = (flags() & uppercase) ? 'B' : 'b'; - *--p = '0'; - } - break; - - case I_BASE_8: // output octal number - p = &buf[74]; - *p = '\0'; - do { - *--p = (char)(n&7) + '0'; - n >>= 3; - } while ( n ); - if ( flags() & showbase ) - *--p = '0'; - break; - - case I_BASE_16: // output hexadecimal number - p = &buf[74]; - *p = '\0'; - hexdigits = (flags() & uppercase) ? - hexdigits_upper : hexdigits_lower; - do { - *--p = hexdigits[(int)n&0xf]; - n >>= 4; - } while ( n ); - if ( flags() & showbase ) { - *--p = (flags() & uppercase) ? 'X' : 'x'; - *--p = '0'; - } - break; - - default: // decimal base is default - p = &buf[74]; - *p = '\0'; - if ( neg ) - n = (unsigned long long)(-(long long)n); - do { - *--p = ((int)(n%10)) + '0'; - n /= 10; - } while ( n ); - if ( neg ) - *--p = '-'; - else if ( flags() & showpos ) - *--p = '+'; - if ( (flags() & internal) && fwidth && !ts_isdigit(*p) ) { - ts_putc( *p ); // special case for internal - ++p; // padding - fwidth--; - return *this << (const char*)p; - } - } - if ( fwidth ) { // adjustment required - if ( !(flags() & left) ) { // but NOT left adjustment - len = tqstrlen(p); - int padlen = fwidth - len; - if ( padlen <= 0 ) { // no padding required - writeBlock( p, len ); - } else if ( padlen < (int)(p-buf) ) { // speeds up padding - memset( p-padlen, (char)fillchar, padlen ); - writeBlock( p-padlen, padlen+len ); - } - else // standard padding - *this << (const char*)p; - } - else - *this << (const char*)p; - fwidth = 0; // reset field width - } - else - writeBlock( p, tqstrlen(p) ); - return *this; -} - - -/*! - \overload - - Writes a \c short integer \a i to the stream and returns a - reference to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( signed short i ) -{ - return output_int( I_SHORT | I_SIGNED, i, i < 0 ); -} - - -/*! - \overload - - Writes an \c unsigned \c short integer \a i to the stream and - returns a reference to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( unsigned short i ) -{ - return output_int( I_SHORT | I_UNSIGNED, i, FALSE ); -} - - -/*! - \overload - - Writes an \c int \a i to the stream and returns a reference to the - stream. -*/ - -TQTextStream &TQTextStream::operator<<( signed int i ) -{ - return output_int( I_INT | I_SIGNED, i, i < 0 ); -} - - -/*! - \overload - - Writes an \c unsigned \c int \a i to the stream and returns a - reference to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( unsigned int i ) -{ - return output_int( I_INT | I_UNSIGNED, i, FALSE ); -} - - -/*! - \overload - - Writes a \c long \c int \a i to the stream and returns a reference - to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( signed long i ) -{ - return output_int( I_LONG | I_SIGNED, i, i < 0 ); -} - - -/*! - \overload - - Writes an \c unsigned \c long \c int \a i to the stream and - returns a reference to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( unsigned long i ) -{ - return output_int( I_LONG | I_UNSIGNED, i, FALSE ); -} - -/*! - \overload - - Writes a \c long long \c int \a i to the stream and returns a reference - to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( signed long long i ) -{ - return output_int( I_LONGLONG | I_SIGNED, i, i < 0 ); -} - - -/*! - \overload - - Writes an \c unsigned \c long \c int \a i to the stream and - returns a reference to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( unsigned long long i ) -{ - return output_int( I_LONGLONG | I_UNSIGNED, i, FALSE ); -} - - -/*! - \overload - - Writes a \c float \a f to the stream and returns a reference to - the stream. -*/ - -TQTextStream &TQTextStream::operator<<( float f ) -{ - return *this << (double)f; -} - -/*! - \overload - - Writes a \c double \a f to the stream and returns a reference to - the stream. -*/ - -TQTextStream &TQTextStream::operator<<( double f ) -{ - CHECK_STREAM_PRECOND - char f_char; - char format[16]; - if ( (flags()&floatfield) == fixed ) - f_char = 'f'; - else if ( (flags()&floatfield) == scientific ) - f_char = (flags() & uppercase) ? 'E' : 'e'; - else - f_char = (flags() & uppercase) ? 'G' : 'g'; - char *fs = format; // generate format string - *fs++ = '%'; // "%.<prec>l<f_char>" - *fs++ = '.'; - int prec = precision(); - if ( prec > 99 ) - prec = 99; - if ( prec >= 10 ) { - *fs++ = prec / 10 + '0'; - *fs++ = prec % 10 + '0'; - } else { - *fs++ = prec + '0'; - } - *fs++ = 'l'; - *fs++ = f_char; - *fs = '\0'; - TQString num; - num.sprintf(format, f); // convert to text - if ( fwidth ) // padding - *this << num.latin1(); - else // just write it - writeBlock(num.latin1(), num.length()); - return *this; -} - - -/*! - \overload - - Writes a string to the stream and returns a reference to the - stream. - - The string \a s is assumed to be Latin1 encoded independent of the - Encoding set for the TQTextStream. -*/ - -TQTextStream &TQTextStream::operator<<( const char* s ) -{ - CHECK_STREAM_PRECOND - char padbuf[48]; - uint len = tqstrlen( s ); // don't write null terminator - if ( fwidth ) { // field width set - int padlen = fwidth - len; - fwidth = 0; // reset width - if ( padlen > 0 ) { - char *ppad; - if ( padlen > 46 ) { // create extra big fill buffer - ppad = new char[padlen]; - TQ_CHECK_PTR( ppad ); - } else { - ppad = padbuf; - } - memset( ppad, (char)fillchar, padlen ); // fill with fillchar - if ( !(flags() & left) ) { - writeBlock( ppad, padlen ); - padlen = 0; - } - writeBlock( s, len ); - if ( padlen ) - writeBlock( ppad, padlen ); - if ( ppad != padbuf ) // delete extra big fill buf - delete[] ppad; - return *this; - } - } - writeBlock( s, len ); - return *this; -} - -/*! - \overload - - Writes \a s to the stream and returns a reference to the stream. - - The string \a s is assumed to be Latin1 encoded independent of the - Encoding set for the TQTextStream. -*/ - -TQTextStream &TQTextStream::operator<<( const TQCString & s ) -{ - return operator<<(s.data()); -} - -/*! - \overload - - Writes \a s to the stream and returns a reference to the stream. -*/ - -TQTextStream &TQTextStream::operator<<( const TQString& s ) -{ - if ( !mapper && latin1 ) - return operator<<(s.latin1()); - CHECK_STREAM_PRECOND - TQString s1 = s; - if ( fwidth ) { // field width set - if ( !(flags() & left) ) { - s1 = s.rightJustify(fwidth, (char)fillchar); - } else { - s1 = s.leftJustify(fwidth, (char)fillchar); - } - fwidth = 0; // reset width - } - writeBlock( s1.unicode(), s1.length() ); - return *this; -} - - -/*! - \overload - - Writes a pointer to the stream and returns a reference to the - stream. - - The \a ptr is output as an unsigned long hexadecimal integer. -*/ - -TQTextStream &TQTextStream::operator<<( void *ptr ) -{ - int f = flags(); - setf( hex, basefield ); - setf( showbase ); - unsetf( uppercase ); - output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE ); - flags( f ); - return *this; -} - - -/*! - \fn int TQTextStream::flags() const - - Returns the current stream flags. The default value is 0. - - \table - \header \i Flag \i Meaning - \row \i \c skipws \i Not currently used; whitespace always skipped - \row \i \c left \i Numeric fields are left-aligned - \row \i \c right - \i Not currently used (by default, numerics are right-aligned) - \row \i \c internal \i Puts any padding spaces between +/- and value - \row \i \c bin \i Output \e and input only in binary - \row \i \c oct \i Output \e and input only in octal - \row \i \c dec \i Output \e and input only in decimal - \row \i \c hex \i Output \e and input only in hexadecimal - \row \i \c showbase - \i Annotates numeric outputs with 0b, 0, or 0x if in \c bin, - \c oct, or \c hex format - \row \i \c showpoint \i Not currently used - \row \i \c uppercase \i Uses 0B and 0X rather than 0b and 0x - \row \i \c showpos \i Shows + for positive numeric values - \row \i \c scientific \i Uses scientific notation for floating point values - \row \i \c fixed \i Uses fixed-point notation for floating point values - \endtable - - Note that unless \c bin, \c oct, \c dec, or \c hex is set, the - input base is octal if the value starts with 0, hexadecimal if it - starts with 0x, binary if it starts with 0b, and decimal - otherwise. - - \sa setf(), unsetf() -*/ - -/*! - \fn int TQTextStream::flags( int f ) - - \overload - - Sets the stream flags to \a f. Returns the previous stream flags. - - \sa setf(), unsetf(), flags() -*/ - -/*! - \fn int TQTextStream::setf( int bits ) - - Sets the stream flag bits \a bits. Returns the previous stream - flags. - - Equivalent to \c{flags( flags() | bits )}. - - \sa setf(), unsetf() -*/ - -/*! - \fn int TQTextStream::setf( int bits, int mask ) - - \overload - - Sets the stream flag bits \a bits with a bit mask \a mask. Returns - the previous stream flags. - - Equivalent to \c{flags( (flags() & ~mask) | (bits & mask) )}. - - \sa setf(), unsetf() -*/ - -/*! - \fn int TQTextStream::unsetf( int bits ) - - Clears the stream flag bits \a bits. Returns the previous stream - flags. - - Equivalent to \c{flags( flags() & ~mask )}. - - \sa setf() -*/ - -/*! - \fn int TQTextStream::width() const - - Returns the field width. The default value is 0. -*/ - -/*! - \fn int TQTextStream::width( int w ) - - \overload - - Sets the field width to \a w. Returns the previous field width. -*/ - -/*! - \fn int TQTextStream::fill() const - - Returns the fill character. The default value is ' ' (space). -*/ - -/*! - \overload int TQTextStream::fill( int f ) - - Sets the fill character to \a f. Returns the previous fill character. -*/ - -/*! - \fn int TQTextStream::precision() const - - Returns the precision. The default value is 6. -*/ - -/*! - \fn int TQTextStream::precision( int p ) - - \overload - - Sets the precision to \a p. Returns the previous precision setting. -*/ - - - /***************************************************************************** - TQTextStream manipulators - *****************************************************************************/ - -TQTextStream &bin( TQTextStream &s ) -{ - s.setf(TQTS::bin,TQTS::basefield); - return s; -} - -TQTextStream &oct( TQTextStream &s ) -{ - s.setf(TQTS::oct,TQTS::basefield); - return s; -} - -TQTextStream &dec( TQTextStream &s ) -{ - s.setf(TQTS::dec,TQTS::basefield); - return s; -} - -TQTextStream &hex( TQTextStream &s ) -{ - s.setf(TQTS::hex,TQTS::basefield); - return s; -} - -TQTextStream &endl( TQTextStream &s ) -{ - return s << '\n'; -} - -TQTextStream &flush( TQTextStream &s ) -{ - if ( s.device() ) - s.device()->flush(); - return s; -} - -TQTextStream &ws( TQTextStream &s ) -{ - s.skipWhiteSpace(); - return s; -} - -TQTextStream &reset( TQTextStream &s ) -{ - s.reset(); - return s; -} - - -/*! - \class TQTextIStream ntqtextstream.h - \reentrant - \brief The TQTextIStream class is a convenience class for input streams. - - \ingroup io - \ingroup text - - This class provides a shorthand for creating simple input - \l{TQTextStream}s without having to pass a \e mode argument to the - constructor. - - This class makes it easy, for example, to write things like this: - \code - TQString data = "123 456"; - int a, b; - TQTextIStream(&data) >> a >> b; - \endcode - - \sa TQTextOStream -*/ - -/*! - \fn TQTextIStream::TQTextIStream( const TQString *s ) - - Constructs a stream to read from the string \a s. -*/ -/*! - \fn TQTextIStream::TQTextIStream( TQByteArray ba ) - - Constructs a stream to read from the array \a ba. -*/ -/*! - \fn TQTextIStream::TQTextIStream( FILE *f ) - - Constructs a stream to read from the file \a f. -*/ - - -/*! - \class TQTextOStream - \reentrant - \brief The TQTextOStream class is a convenience class for output streams. - - \ingroup io - \ingroup text - - This class provides a shorthand for creating simple output - \l{TQTextStream}s without having to pass a \e mode argument to the - constructor. - - This makes it easy for example, to write things like this: - \code - TQString result; - TQTextOStream(&result) << "pi = " << 3.14; - \endcode -*/ - -/*! - \fn TQTextOStream::TQTextOStream( TQString *s ) - - Constructs a stream to write to string \a s. -*/ -/*! - \fn TQTextOStream::TQTextOStream( TQByteArray ba ) - - Constructs a stream to write to the array \a ba. -*/ -/*! - \fn TQTextOStream::TQTextOStream( FILE *f ) - - Constructs a stream to write to the file \a f. -*/ - - - -/*! - Sets the encoding of this stream to \a e, where \a e is one of the - following values: - \table - \header \i Encoding \i Meaning - \row \i Locale - \i Uses local file format (Latin1 if locale is not set), but - autodetecting Unicode(utf16) on input. - \row \i Unicode - \i Uses Unicode(utf16) for input and output. Output will be - written in the order most efficient for the current platform - (i.e. the order used internally in TQString). - \row \i UnicodeUTF8 - \i Using Unicode(utf8) for input and output. If you use it for - input it will autodetect utf16 and use it instead of utf8. - \row \i Latin1 - \i ISO-8859-1. Will not autodetect utf16. - \row \i UnicodeNetworkOrder - \i Uses network order Unicode(utf16) for input and output. - Useful when reading Unicode data that does not start with the - byte order marker. - \row \i UnicodeReverse - \i Uses reverse network order Unicode(utf16) for input and - output. Useful when reading Unicode data that does not start - with the byte order marker or when writing data that should be - read by buggy Windows applications. - \row \i RawUnicode - \i Like Unicode, but does not write the byte order marker nor - does it auto-detect the byte order. Useful only when writing to - non-persistent storage used by a single process. - \endtable - - \c Locale and all Unicode encodings, except \c RawUnicode, will look - at the first two bytes in an input stream to determine the byte - order. The initial byte order marker will be stripped off before - data is read. - - Note that this function should be called before any data is read to - or written from the stream. - - \sa setCodec() -*/ - -void TQTextStream::setEncoding( Encoding e ) -{ - if ( d->sourceType == TQTextStreamPrivate::String ) - return; - - switch ( e ) { - case Unicode: - mapper = 0; - latin1 = FALSE; - doUnicodeHeader = TRUE; - internalOrder = TRUE; - networkOrder = TQChar::networkOrdered(); - break; - case UnicodeUTF8: -#ifndef TQT_NO_TEXTCODEC - mapper = TQTextCodec::codecForMib( 106 ); - latin1 = FALSE; - doUnicodeHeader = TRUE; - internalOrder = TRUE; - networkOrder = TQChar::networkOrdered(); -#else - mapper = 0; - latin1 = TRUE; - doUnicodeHeader = TRUE; -#endif - break; - case UnicodeNetworkOrder: - mapper = 0; - latin1 = FALSE; - doUnicodeHeader = TRUE; - internalOrder = TQChar::networkOrdered(); - networkOrder = TRUE; - break; - case UnicodeReverse: - mapper = 0; - latin1 = FALSE; - doUnicodeHeader = TRUE; - internalOrder = !TQChar::networkOrdered(); - networkOrder = FALSE; - break; - case RawUnicode: - mapper = 0; - latin1 = FALSE; - doUnicodeHeader = FALSE; - internalOrder = TRUE; - networkOrder = TQChar::networkOrdered(); - break; - case Locale: - latin1 = TRUE; // fallback to Latin-1 -#ifndef TQT_NO_TEXTCODEC - mapper = TQTextCodec::codecForLocale(); - // optimized Latin-1 processing -#if defined(Q_OS_WIN32) - if ( GetACP() == 1252 ) - mapper = 0; -#endif - if ( mapper && mapper->mibEnum() == 4 ) -#endif - mapper = 0; - - doUnicodeHeader = TRUE; // If it reads as Unicode, accept it - break; - case Latin1: - mapper = 0; - doUnicodeHeader = FALSE; - latin1 = TRUE; - break; - } -} - - -#ifndef TQT_NO_TEXTCODEC -/*! - Sets the codec for this stream to \a codec. Will not try to - autodetect Unicode. - - Note that this function should be called before any data is read - to/written from the stream. - - \sa setEncoding(), codec() -*/ - -void TQTextStream::setCodec( TQTextCodec *codec ) -{ - if ( d->sourceType == TQTextStreamPrivate::String ) - return; // TQString does not need any codec - mapper = codec; - latin1 = ( codec->mibEnum() == 4 ); - if ( latin1 ) - mapper = 0; - doUnicodeHeader = FALSE; -} - -/*! - Returns the codec actually used for this stream. - - If Unicode is automatically detected in input, a codec with \link - TQTextCodec::name() name() \endlink "ISO-10646-UCS-2" is returned. - - \sa setCodec() -*/ - -TQTextCodec *TQTextStream::codec() -{ - if ( mapper ) { - return mapper; - } else { - // 4 is "ISO 8859-1", 1000 is "ISO-10646-UCS-2" - return TQTextCodec::codecForMib( latin1 ? 4 : 1000 ); - } -} - -#endif - -#endif // TQT_NO_TEXTSTREAM diff --git a/src/tools/tqstring.cpp b/src/tools/tqstring.cpp index a48af12f..fff59c61 100644 --- a/src/tools/tqstring.cpp +++ b/src/tools/tqstring.cpp @@ -54,7 +54,7 @@ #include "ntqregexp.h" #include "ntqdatastream.h" #ifndef TQT_NO_TEXTCODEC -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #endif #include "ntqlocale.h" #include "qlocale_p.h" diff --git a/src/tools/tqtextstream.cpp b/src/tools/tqtextstream.cpp new file mode 100644 index 00000000..218c9b10 --- /dev/null +++ b/src/tools/tqtextstream.cpp @@ -0,0 +1,2632 @@ +/**************************************************************************** +** +** Implementation of TQTextStream class +** +** Created : 940922 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextstream.h" + +#ifndef TQT_NO_TEXTSTREAM +#include "tqtextcodec.h" +#include "ntqregexp.h" +#include "ntqbuffer.h" +#include "ntqfile.h" +#include <stdio.h> +#include <ctype.h> +#include <stdlib.h> +#ifndef Q_OS_TEMP +#include <locale.h> +#endif + +#if defined(Q_OS_WIN32) +#include "qt_windows.h" +#endif + +/*! + \class TQTextStream tqtextstream.h + \reentrant + \brief The TQTextStream class provides basic functions for reading + and writing text using a TQIODevice. + + \ingroup io + \ingroup text + \mainclass + + The text stream class has a functional interface that is very + similar to that of the standard C++ iostream class. + + TQt provides several global functions similar to the ones in iostream: + \table + \header \i Function \i Meaning + \row \i bin \i sets the TQTextStream to read/write binary numbers + \row \i oct \i sets the TQTextStream to read/write octal numbers + \row \i dec \i sets the TQTextStream to read/write decimal numbers + \row \i hex \i sets the TQTextStream to read/write hexadecimal numbers + \row \i endl \i forces a line break + \row \i flush \i forces the TQIODevice to flush any buffered data + \row \i ws \i eats any available whitespace (on input) + \row \i reset \i resets the TQTextStream to its default mode (see reset()) + \row \i qSetW(int) \i sets the \link width() field width \endlink + to the given argument + \row \i qSetFill(int) \i sets the \link fill() fill character + \endlink to the given argument + \row \i qSetPrecision(int) \i sets the \link precision() precision + \endlink to the given argument + \endtable + + \warning By default TQTextStream will automatically detect whether + integers in the stream are in decimal, octal, hexadecimal or + binary format when reading from the stream. In particular, a + leading '0' signifies octal, i.e. the sequence "0100" will be + interpreted as 64. + + The TQTextStream class reads and writes text; it is not appropriate + for dealing with binary data (but TQDataStream is). + + By default, output of Unicode text (i.e. TQString) is done using + the local 8-bit encoding. This can be changed using the + setEncoding() method. For input, the TQTextStream will auto-detect + standard Unicode "byte order marked" text files; otherwise the + local 8-bit encoding is used. + + The TQIODevice is set in the constructor, or later using + setDevice(). If the end of the input is reached atEnd() returns + TRUE. Data can be read into variables of the appropriate type + using the operator>>() overloads, or read in its entirety into a + single string using read(), or read a line at a time using + readLine(). Whitespace can be skipped over using skipWhiteSpace(). + You can set flags for the stream using flags() or setf(). The + stream also supports width(), precision() and fill(); use reset() + to reset the defaults. + + \sa TQDataStream +*/ + +/*! + \enum TQTextStream::Encoding + + \value Locale + \value Latin1 + \value Unicode + \value UnicodeNetworkOrder + \value UnicodeReverse + \value RawUnicode + \value UnicodeUTF8 + + See setEncoding() for an explanation of the encodings. +*/ + +/* + \class TQTSManip + + \brief The TQTSManip class is an internal helper class for the + TQTextStream. + + It is generally a very bad idea to use this class directly in + application programs. + + \internal + + This class makes it possible to give the TQTextStream function objects + with arguments, like this: + \code + TQTextStream cout( stdout, IO_WriteOnly ); + cout << setprecision( 8 ); // TQTSManip used here! + cout << 3.14159265358979323846; + \endcode + + The setprecision() function returns a TQTSManip object. + The TQTSManip object contains a pointer to a member function in + TQTextStream and an integer argument. + When serializing a TQTSManip into a TQTextStream, the function + is executed with the argument. +*/ + +/*! \fn TQTSManip::TQTSManip( TQTSMFI m, int a ) + + Constructs a TQTSManip object which will call \a m (a member function + in TQTextStream which accepts a single int) with argument \a a when + TQTSManip::exec() is called. Used internally in e.g. endl: + + \code + s << "some text" << endl << "more text"; + \endcode +*/ + +/*! \fn void TQTSManip::exec( TQTextStream& s ) + + Calls the member function specified in the constructor, for object + \a s. Used internally in e.g. endl: + + \code + s << "some text" << endl << "more text"; + \endcode +*/ + + +/***************************************************************************** + TQTextStream member functions + *****************************************************************************/ + +#if defined(QT_CHECK_STATE) +#undef CHECK_STREAM_PRECOND +#define CHECK_STREAM_PRECOND if ( !dev ) { \ + tqWarning( "TQTextStream: No device" ); \ + return *this; } +#else +#define CHECK_STREAM_PRECOND +#endif + + +#define I_SHORT 0x0010 +#define I_INT 0x0020 +#define I_LONG 0x0030 +#define I_LONGLONG 0x0040 +#define I_TYPE_MASK 0x00f0 + +#define I_BASE_2 TQTS::bin +#define I_BASE_8 TQTS::oct +#define I_BASE_10 TQTS::dec +#define I_BASE_16 TQTS::hex +#define I_BASE_MASK (TQTS::bin | TQTS::oct | TQTS::dec | TQTS::hex) + +#define I_SIGNED 0x0100 +#define I_UNSIGNED 0x0200 +#define I_SIGN_MASK 0x0f00 + + +static const TQChar TQEOF = TQChar((ushort)0xffff); //guaranteed not to be a character. +static const uint getline_buf_size = 256; // bufsize used by ts_getline() + +const int TQTextStream::basefield = I_BASE_MASK; +const int TQTextStream::adjustfield = ( TQTextStream::left | + TQTextStream::right | + TQTextStream::internal ); +const int TQTextStream::floatfield = ( TQTextStream::scientific | + TQTextStream::fixed ); + + +class TQTextStreamPrivate { +public: +#ifndef TQT_NO_TEXTCODEC + TQTextStreamPrivate() + : decoder( 0 ), encoder( 0 ), sourceType( NotSet ) { } + ~TQTextStreamPrivate() { + delete decoder; + delete encoder; + } + TQTextDecoder *decoder; + TQTextEncoder *encoder; +#else + TQTextStreamPrivate() : sourceType( NotSet ) { } + ~TQTextStreamPrivate() { } +#endif + TQString ungetcBuf; + + enum SourceType { NotSet, IODevice, String, ByteArray, File }; + SourceType sourceType; +}; + + +// skips whitespace and returns the first non-whitespace character +TQChar TQTextStream::eat_ws() +{ + TQChar c; + do { c = ts_getc(); } while ( c != TQEOF && ts_isspace(c) ); + return c; +} + +void TQTextStream::init() +{ + // ### ungetcBuf = TQEOF; + dev = 0; + owndev = FALSE; + mapper = 0; + d = new TQTextStreamPrivate; + doUnicodeHeader = TRUE; // autodetect + latin1 = TRUE; // should use locale? + internalOrder = TQChar::networkOrdered(); + networkOrder = TRUE; +} + +/*! + Constructs a data stream that has no IO device. +*/ + +TQTextStream::TQTextStream() +{ + init(); + setEncoding( Locale ); + reset(); + d->sourceType = TQTextStreamPrivate::NotSet; +} + +/*! + Constructs a text stream that uses the IO device \a iod. +*/ + +TQTextStream::TQTextStream( TQIODevice *iod ) +{ + init(); + setEncoding( Locale ); + dev = iod; + reset(); + d->sourceType = TQTextStreamPrivate::IODevice; +} + +// TODO: use special-case handling of this case in TQTextStream, and +// simplify this class to only deal with TQChar or TQString data. +class TQStringBuffer : public TQIODevice { +public: + TQStringBuffer( TQString* str ); + ~TQStringBuffer(); + bool open( int m ); + void close(); + void flush(); + Offset size() const; + Offset at() const; + bool at( Offset pos ); + TQ_LONG readBlock( char *p, TQ_ULONG len ); + TQ_LONG writeBlock( const char *p, TQ_ULONG len ); + int getch(); + int putch( int ch ); + int ungetch( int ch ); +protected: + TQString* s; + +private: + TQStringBuffer( const TQStringBuffer & ); + TQStringBuffer &operator=( const TQStringBuffer & ); +}; + + +TQStringBuffer::TQStringBuffer( TQString* str ) +{ + s = str; +} + +TQStringBuffer::~TQStringBuffer() +{ +} + + +bool TQStringBuffer::open( int m ) +{ + if ( !s ) { +#if defined(QT_CHECK_STATE) + tqWarning( "TQStringBuffer::open: No string" ); +#endif + return FALSE; + } + if ( isOpen() ) { +#if defined(QT_CHECK_STATE) + tqWarning( "TQStringBuffer::open: Buffer already open" ); +#endif + return FALSE; + } + setMode( m ); + if ( m & IO_Truncate ) + s->truncate( 0 ); + + if ( m & IO_Append ) { + ioIndex = s->length()*sizeof(TQChar); + } else { + ioIndex = 0; + } + setState( IO_Open ); + resetStatus(); + return TRUE; +} + +void TQStringBuffer::close() +{ + if ( isOpen() ) { + setFlags( IO_Direct ); + ioIndex = 0; + } +} + +void TQStringBuffer::flush() +{ +} + +TQIODevice::Offset TQStringBuffer::size() const +{ + return s ? s->length()*sizeof(TQChar) : 0; +} + +TQIODevice::Offset TQStringBuffer::at() const +{ + return ioIndex; +} + +bool TQStringBuffer::at( Offset pos ) +{ +#if defined(QT_CHECK_STATE) + if ( !isOpen() ) { + tqWarning( "TQStringBuffer::at: Buffer is not open" ); + return FALSE; + } +#endif + if ( pos >= s->length()*2 ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQStringBuffer::at: Index %lu out of range", pos ); +#endif + return FALSE; + } + ioIndex = pos; + return TRUE; +} + + +TQ_LONG TQStringBuffer::readBlock( char *p, TQ_ULONG len ) +{ +#if defined(QT_CHECK_STATE) + TQ_CHECK_PTR( p ); + if ( !isOpen() ) { + tqWarning( "TQStringBuffer::readBlock: Buffer not open" ); + return -1; + } + if ( !isReadable() ) { + tqWarning( "TQStringBuffer::readBlock: Read operation not permitted" ); + return -1; + } +#endif + if ( ioIndex + len > s->length()*sizeof(TQChar) ) { + // overflow + if ( (uint)ioIndex >= s->length()*sizeof(TQChar) ) { + setStatus( IO_ReadError ); + return -1; + } else { + len = s->length()*2 - (uint)ioIndex; + } + } + memcpy( p, ((const char*)(s->unicode()))+ioIndex, len ); + ioIndex += len; + return len; +} + +TQ_LONG TQStringBuffer::writeBlock( const char *p, TQ_ULONG len ) +{ +#if defined(QT_CHECK_NULL) + if ( p == 0 && len != 0 ) + tqWarning( "TQStringBuffer::writeBlock: Null pointer error" ); +#endif +#if defined(QT_CHECK_STATE) + if ( !isOpen() ) { + tqWarning( "TQStringBuffer::writeBlock: Buffer not open" ); + return -1; + } + if ( !isWritable() ) { + tqWarning( "TQStringBuffer::writeBlock: Write operation not permitted" ); + return -1; + } + if ( ioIndex&1 ) { + tqWarning( "TQStringBuffer::writeBlock: non-even index - non Unicode" ); + return -1; + } + if ( len&1 ) { + tqWarning( "TQStringBuffer::writeBlock: non-even length - non Unicode" ); + return -1; + } +#endif + s->replace(ioIndex/2, len/2, (TQChar*)p, len/2); + ioIndex += len; + return len; +} + +int TQStringBuffer::getch() +{ +#if defined(QT_CHECK_STATE) + if ( !isOpen() ) { + tqWarning( "TQStringBuffer::getch: Buffer not open" ); + return -1; + } + if ( !isReadable() ) { + tqWarning( "TQStringBuffer::getch: Read operation not permitted" ); + return -1; + } +#endif + if ( (uint)ioIndex >= s->length()*2 ) { // overflow + setStatus( IO_ReadError ); + return -1; + } + return (int)((const uchar *)s->unicode())[ioIndex++]; +} + +int TQStringBuffer::putch( int ch ) +{ + char c = ch; + if ( writeBlock(&c,1) < 0 ) + return -1; + else + return ch; +} + +int TQStringBuffer::ungetch( int ch ) +{ +#if defined(QT_CHECK_STATE) + if ( !isOpen() ) { + tqWarning( "TQStringBuffer::ungetch: Buffer not open" ); + return -1; + } + if ( !isReadable() ) { + tqWarning( "TQStringBuffer::ungetch: Read operation not permitted" ); + return -1; + } +#endif + if ( ch != -1 ) { // something to do with eof + if ( ioIndex ) + ioIndex--; + else + ch = -1; + } + return ch; +} + + +/*! + Constructs a text stream that operates on the Unicode TQString, \a + str, through an internal device. The \a filemode argument is + passed to the device's open() function; see \l{TQIODevice::mode()}. + + If you set an encoding or codec with setEncoding() or setCodec(), + this setting is ignored for text streams that operate on TQString. + + Example: + \code + TQString str; + TQTextStream ts( &str, IO_WriteOnly ); + ts << "pi = " << 3.14; // str == "pi = 3.14" + \endcode + + Writing data to the text stream will modify the contents of the + string. The string will be expanded when data is written beyond + the end of the string. Note that the string will not be truncated: + \code + TQString str = "pi = 3.14"; + TQTextStream ts( &str, IO_WriteOnly ); + ts << "2+2 = " << 2+2; // str == "2+2 = 414" + \endcode + + Note that because TQString is Unicode, you should not use + readRawBytes() or writeRawBytes() on such a stream. +*/ + +TQTextStream::TQTextStream( TQString* str, int filemode ) +{ + // TODO: optimize for this case as it becomes more common + // (see TQStringBuffer above) + init(); + dev = new TQStringBuffer( str ); + ((TQStringBuffer *)dev)->open( filemode ); + owndev = TRUE; + setEncoding(RawUnicode); + reset(); + d->sourceType = TQTextStreamPrivate::String; +} + +/*! \obsolete + + This constructor is equivalent to the constructor taking a TQString* + parameter. +*/ + +TQTextStream::TQTextStream( TQString& str, int filemode ) +{ + init(); + dev = new TQStringBuffer( &str ); + ((TQStringBuffer *)dev)->open( filemode ); + owndev = TRUE; + setEncoding(RawUnicode); + reset(); + d->sourceType = TQTextStreamPrivate::String; +} + +/*! + Constructs a text stream that operates on the byte array, \a a, + through an internal TQBuffer device. The \a mode argument is passed + to the device's open() function; see \l{TQIODevice::mode()}. + + Example: + \code + TQByteArray array; + TQTextStream ts( array, IO_WriteOnly ); + ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14" + \endcode + + Writing data to the text stream will modify the contents of the + array. The array will be expanded when data is written beyond the + end of the string. + + Same example, using a TQBuffer: + \code + TQByteArray array; + TQBuffer buf( array ); + buf.open( IO_WriteOnly ); + TQTextStream ts( &buf ); + ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14" + buf.close(); + \endcode +*/ + +TQTextStream::TQTextStream( TQByteArray a, int mode ) +{ + init(); + dev = new TQBuffer( a ); + ((TQBuffer *)dev)->open( mode ); + owndev = TRUE; + setEncoding( Latin1 ); //### Locale??? + reset(); + d->sourceType = TQTextStreamPrivate::ByteArray; +} + +/*! + Constructs a text stream that operates on an existing file handle + \a fh through an internal TQFile device. The \a mode argument is + passed to the device's open() function; see \l{TQIODevice::mode()}. + + Note that if you create a TQTextStream \c cout or another name that + is also used for another variable of a different type, some + linkers may confuse the two variables, which will often cause + crashes. +*/ + +TQTextStream::TQTextStream( FILE *fh, int mode ) +{ + init(); + setEncoding( Locale ); //### + dev = new TQFile; + ((TQFile *)dev)->open( mode, fh ); + owndev = TRUE; + reset(); + d->sourceType = TQTextStreamPrivate::File; +} + +/*! + Destroys the text stream. + + The destructor does not affect the current IO device. +*/ + +TQTextStream::~TQTextStream() +{ + if ( owndev ) + delete dev; + delete d; +} + +/*! + Positions the read pointer at the first non-whitespace character. +*/ +void TQTextStream::skipWhiteSpace() +{ + ts_ungetc( eat_ws() ); +} + + +/*! + Tries to read \a len characters from the stream and stores them in + \a buf. Returns the number of characters really read. + + \warning There will no TQEOF appended if the read reaches the end + of the file. EOF is reached when the return value does not equal + \a len. +*/ +uint TQTextStream::ts_getbuf( TQChar* buf, uint len ) +{ + if ( len < 1 ) + return 0; + + uint rnum = 0; // the number of TQChars really read + + if ( d && d->ungetcBuf.length() ) { + while ( rnum < len && rnum < d->ungetcBuf.length() ) { + *buf = d->ungetcBuf.constref( rnum ); + buf++; + rnum++; + } + d->ungetcBuf = d->ungetcBuf.mid( rnum ); + if ( rnum >= len ) + return rnum; + } + + // we use dev->ungetch() for one of the bytes of the unicode + // byte-order mark, but a local unget hack for the other byte: + int ungetHack = EOF; + + if ( doUnicodeHeader ) { + doUnicodeHeader = FALSE; // only at the top + int c1 = dev->getch(); + if ( c1 == EOF ) + return rnum; + int c2 = dev->getch(); + if ( c1 == 0xfe && c2 == 0xff ) { + mapper = 0; + latin1 = FALSE; + internalOrder = TQChar::networkOrdered(); + networkOrder = TRUE; + } else if ( c1 == 0xff && c2 == 0xfe ) { + mapper = 0; + latin1 = FALSE; + internalOrder = !TQChar::networkOrdered(); + networkOrder = FALSE; + } else { + if ( c2 != EOF ) { + dev->ungetch( c2 ); + ungetHack = c1; + } else { + /* + A small bug might hide here. If only the first byte + of a file has made it so far, and that first byte + is half of the byte-order mark, then the utfness + will not be detected. + */ + dev->ungetch( c1 ); + } + } + } + +#ifndef TQT_NO_TEXTCODEC + if ( mapper ) { + bool shortRead = FALSE; + if ( !d->decoder ) + d->decoder = mapper->makeDecoder(); + while( rnum < len ) { + TQString s; + bool readBlock = !( len == 1+rnum ); + for (;;) { + // for efficiency: normally read a whole block + if ( readBlock ) { + // guess buffersize; this may be wrong (too small or too + // big). But we can handle this (either iterate reading + // or use ungetcBuf). + // Note that this might cause problems for codecs where + // one byte can result in >1 Unicode Characters if bytes + // are written to the stream in the meantime (loss of + // synchronicity). + uint rlen = len - rnum; + char *cbuf = new char[ rlen ]; + if ( ungetHack != EOF ) { + rlen = 1+dev->readBlock( cbuf+1, rlen-1 ); + cbuf[0] = (char)ungetHack; + ungetHack = EOF; + } else { + rlen = dev->readBlock( cbuf, rlen ); + } + s += d->decoder->toUnicode( cbuf, rlen ); + delete[] cbuf; + // use buffered reading only for the first time, because we + // have to get the stream synchronous again (this is easier + // with single character reading) + readBlock = FALSE; + } + // get stream (and codec) in sync + int c; + if ( ungetHack == EOF ) { + c = dev->getch(); + } else { + c = ungetHack; + ungetHack = EOF; + } + if ( c == EOF ) { + shortRead = TRUE; + break; + } + char b = c; + uint lengthBefore = s.length(); + s += d->decoder->toUnicode( &b, 1 ); + if ( s.length() > lengthBefore ) + break; // it seems we are in sync now + } + uint i = 0; + uint end = TQMIN( len-rnum, s.length() ); + while( i < end ) { + *buf = s.constref(i++); + buf++; + } + rnum += end; + if ( s.length() > i ) { + // could be = but append is clearer + d->ungetcBuf.append( s.mid( i ) ); + } + if ( shortRead ) + return rnum; + } + } else +#endif + if ( latin1 ) { + if ( len == 1+rnum ) { + // use this method for one character because it is more efficient + // (arnt doubts whether it makes a difference, but lets it stand) + int c = (ungetHack == EOF) ? dev->getch() : ungetHack; + if ( c != EOF ) { + *buf = (char)c; + buf++; + rnum++; + } + } else { + if ( ungetHack != EOF ) { + *buf = (char)ungetHack; + buf++; + rnum++; + ungetHack = EOF; + } + char *cbuf = new char[len - rnum]; + while ( !dev->atEnd() && rnum < len ) { + uint rlen = len - rnum; + rlen = dev->readBlock( cbuf, rlen ); + char *it = cbuf; + char *end = cbuf + rlen; + while ( it < end ) { + *buf = *it; + buf++; + it++; + } + rnum += rlen; + } + delete[] cbuf; + } + } else { // UCS-2 or UTF-16 + if ( len == 1+rnum ) { + int c1 = (ungetHack == EOF) ? dev->getch() : ungetHack; + if ( c1 == EOF ) + return rnum; + int c2 = dev->getch(); + if ( c2 == EOF ) + return rnum; + + if ( networkOrder ) { + *buf = TQChar( c2, c1 ); + } else { + *buf = TQChar( c1, c2 ); + } + buf++; + rnum++; + } else { + char *cbuf = new char[ 2*( len - rnum ) ]; // for paranoids: overflow possible + while ( !dev->atEnd() && rnum < len ) { + uint rlen = 2 * ( len-rnum ); + if ( ungetHack != EOF ) { + rlen = 1+dev->readBlock( cbuf+1, rlen-1 ); + cbuf[0] = (char)ungetHack; + ungetHack = EOF; + } else { + rlen = dev->readBlock( cbuf, rlen ); + } + // We can't use an odd number of bytes, so put it back. But + // do it only if we are capable of reading more -- normally + // there should not be an odd number, but the file might be + // truncated or not in UTF-16... + if ( (rlen & 1) == 1 ) + if ( !dev->atEnd() ) + dev->ungetch( cbuf[--rlen] ); + uint i = 0; + if ( networkOrder ) { + while( i < rlen ) { + *buf = TQChar( cbuf[i+1], cbuf[i] ); + buf++; + i+=2; + } + } else { + while( i < rlen ) { + *buf = TQChar( cbuf[i], cbuf[i+1] ); + buf++; + i+=2; + } + } + rnum += i/2; + } + delete[] cbuf; + } + } + return rnum; +} + +/*! + Tries to read one line, but at most len characters from the stream + and stores them in \a buf. + + Returns the number of characters really read. Newlines are not + stripped. + + There will be a TQEOF appended if the read reaches the end of file; + this is different to ts_getbuf(). + + This function works only if a newline (as byte) is also a newline + (as resulting character) since it uses TQIODevice::readLine(). So + use it only for such codecs where this is true! + + This function is (almost) a no-op for UTF 16. Don't use it if + doUnicodeHeader is TRUE! +*/ +uint TQTextStream::ts_getline( TQChar* buf ) +{ + uint rnum=0; // the number of TQChars really read + char cbuf[ getline_buf_size+1 ]; + + if ( d && d->ungetcBuf.length() ) { + while( rnum < getline_buf_size && rnum < d->ungetcBuf.length() ) { + buf[rnum] = d->ungetcBuf.constref(rnum); + rnum++; + } + d->ungetcBuf = d->ungetcBuf.mid( rnum ); + if ( rnum >= getline_buf_size ) + return rnum; + } + +#ifndef TQT_NO_TEXTCODEC + if ( mapper ) { + if ( !d->decoder ) + d->decoder = mapper->makeDecoder(); + TQString s; + bool readBlock = TRUE; + for (;;) { + // for efficiency: try to read a line + if ( readBlock ) { + int rlen = getline_buf_size - rnum; + rlen = dev->readLine( cbuf, rlen+1 ); + if ( rlen == -1 ) + rlen = 0; + s += d->decoder->toUnicode( cbuf, rlen ); + readBlock = FALSE; + } + if ( dev->atEnd() + || s.at( s.length()-1 ) == '\n' + || s.at( s.length()-1 ) == '\r' + ) { + break; + } else { + // get stream (and codec) in sync + int c; + c = dev->getch(); + if ( c == EOF ) { + break; + } + char b = c; + uint lengthBefore = s.length(); + s += d->decoder->toUnicode( &b, 1 ); + if ( s.length() > lengthBefore ) + break; // it seems we are in sync now + } + } + uint i = 0; + while( rnum < getline_buf_size && i < s.length() ) + buf[rnum++] = s.constref(i++); + if ( s.length() > i ) + // could be = but append is clearer + d->ungetcBuf.append( s.mid( i ) ); + if ( rnum < getline_buf_size && dev->atEnd() ) + buf[rnum++] = TQEOF; + } else +#endif + if ( latin1 ) { + int rlen = getline_buf_size - rnum; + rlen = dev->readLine( cbuf, rlen+1 ); + if ( rlen == -1 ) + rlen = 0; + char *end = cbuf+rlen; + char *it = cbuf; + buf +=rnum; + while ( it != end ) { + buf->setCell( *(it++) ); + buf->setRow( 0 ); + buf++; + } + rnum += rlen; + if ( rnum < getline_buf_size && dev->atEnd() ) + buf[1] = TQEOF; + } + return rnum; +} + + +/*! + Puts one character into the stream. +*/ +void TQTextStream::ts_putc( TQChar c ) +{ +#ifndef TQT_NO_TEXTCODEC + if ( mapper ) { + if ( !d->encoder ) + d->encoder = mapper->makeEncoder(); + int len = 1; + TQString s = c; + TQCString block = d->encoder->fromUnicode( s, len ); + dev->writeBlock( block, len ); + } else +#endif + if ( latin1 ) { + if ( c.row() ) + dev->putch( '?' ); // unknown character + else + dev->putch( c.cell() ); + } else { + if ( doUnicodeHeader ) { + doUnicodeHeader = FALSE; + ts_putc( TQChar::byteOrderMark ); + } + if ( internalOrder ) { + // this case is needed by TQStringBuffer + dev->writeBlock( (char*)&c, sizeof(TQChar) ); + } else if ( networkOrder ) { + dev->putch( c.row() ); + dev->putch( c.cell() ); + } else { + dev->putch( c.cell() ); + dev->putch( c.row() ); + } + } +} + +/*! + Puts one character into the stream. +*/ +void TQTextStream::ts_putc( int ch ) +{ + ts_putc( TQChar((ushort)ch) ); +} + +bool TQTextStream::ts_isdigit( TQChar c ) +{ + return c.isDigit(); +} + +bool TQTextStream::ts_isspace( TQChar c ) +{ + return c.isSpace(); +} + +void TQTextStream::ts_ungetc( TQChar c ) +{ + if ( c.unicode() == 0xffff ) + return; + + d->ungetcBuf.prepend( c ); +} + + + +/*! + Reads \a len bytes from the stream into \a s and returns a + reference to the stream. + + The buffer \a s must be preallocated. + + Note that no encoding is done by this function. + + \warning The behavior of this function is undefined unless the + stream's encoding is set to Unicode or Latin1. + + \sa TQIODevice::readBlock() +*/ + +TQTextStream &TQTextStream::readRawBytes( char *s, uint len ) +{ + dev->readBlock( s, len ); + return *this; +} + +/*! + Writes the \a len bytes from \a s to the stream and returns a + reference to the stream. + + Note that no encoding is done by this function. + + \sa TQIODevice::writeBlock() +*/ + +TQTextStream &TQTextStream::writeRawBytes( const char* s, uint len ) +{ + dev->writeBlock( s, len ); + return *this; +} + + +TQTextStream &TQTextStream::writeBlock( const char* p, uint len ) +{ + if ( doUnicodeHeader ) { + doUnicodeHeader = FALSE; + if ( !mapper && !latin1 ) + ts_putc( TQChar::byteOrderMark ); + } + // TQCString and const char * are treated as Latin-1 + if ( !mapper && latin1 ) { + dev->writeBlock( p, len ); + } else if ( !mapper && internalOrder ) { + TQChar *u = new TQChar[len]; + for ( uint i = 0; i < len; i++ ) + u[i] = p[i]; + dev->writeBlock( (char*)u, len * sizeof(TQChar) ); + delete [] u; + } +#ifndef TQT_NO_TEXTCODEC + else if (mapper) { + if (!d->encoder) + d->encoder = mapper->makeEncoder(); + TQString s = TQString::fromLatin1(p, len); + int l = len; + TQCString block = d->encoder->fromUnicode(s, l); + dev->writeBlock(block, l); + } +#endif + else { + for ( uint i = 0; i < len; i++ ) + ts_putc( (uchar)p[i] ); + } + return *this; +} + +TQTextStream &TQTextStream::writeBlock( const TQChar* p, uint len ) +{ +#ifndef TQT_NO_TEXTCODEC + if ( mapper ) { + if ( !d->encoder ) + d->encoder = mapper->makeEncoder(); + TQConstString s( p, len ); + int l = len; + TQCString block = d->encoder->fromUnicode( s.string(), l ); + dev->writeBlock( block, l ); + } else +#endif + if ( latin1 ) { + char *str = TQString::unicodeToLatin1( p, len ); + dev->writeBlock( str, len ); + delete [] str; + } else if ( internalOrder ) { + if ( doUnicodeHeader ) { + doUnicodeHeader = FALSE; + ts_putc( TQChar::byteOrderMark ); + } + dev->writeBlock( (char*)p, sizeof(TQChar)*len ); + } else { + for (uint i=0; i<len; i++) + ts_putc( p[i] ); + } + return *this; +} + +/*! + Resets the text stream. + + \list + \i All flags are set to 0. + \i The field width is set to 0. + \i The fill character is set to ' ' (Space). + \i The precision is set to 6. + \endlist + + \sa setf(), width(), fill(), precision() +*/ + +void TQTextStream::reset() +{ + fflags = 0; + fwidth = 0; + fillchar = ' '; + fprec = 6; +} + +/*! + \fn TQIODevice *TQTextStream::device() const + + Returns the IO device currently set. + + \sa setDevice(), unsetDevice() +*/ + +/*! + Sets the IO device to \a iod. + + \sa device(), unsetDevice() +*/ + +void TQTextStream::setDevice( TQIODevice *iod ) +{ + if ( owndev ) { + delete dev; + owndev = FALSE; + } + dev = iod; + d->sourceType = TQTextStreamPrivate::IODevice; +} + +/*! + Unsets the IO device. Equivalent to setDevice( 0 ). + + \sa device(), setDevice() +*/ + +void TQTextStream::unsetDevice() +{ + setDevice( 0 ); + d->sourceType = TQTextStreamPrivate::NotSet; +} + +/*! + \fn bool TQTextStream::atEnd() const + + Returns TRUE if the IO device has reached the end position (end of + the stream or file) or if there is no IO device set; otherwise + returns FALSE. + + \sa TQIODevice::atEnd() +*/ + +/*!\fn bool TQTextStream::eof() const + + \obsolete + + This function has been renamed to atEnd(). + + \sa TQIODevice::atEnd() +*/ + +/***************************************************************************** + TQTextStream read functions + *****************************************************************************/ + + +/*! + \overload + + Reads a char \a c from the stream and returns a reference to the + stream. Note that whitespace is skipped. +*/ + +TQTextStream &TQTextStream::operator>>( char &c ) +{ + CHECK_STREAM_PRECOND + c = eat_ws(); + return *this; +} + +/*! + Reads a char \a c from the stream and returns a reference to the + stream. Note that whitespace is \e not skipped. +*/ + +TQTextStream &TQTextStream::operator>>( TQChar &c ) +{ + CHECK_STREAM_PRECOND + c = ts_getc(); + return *this; +} + + +ulong TQTextStream::input_bin() +{ + ulong val = 0; + TQChar ch = eat_ws(); + int dv = ch.digitValue(); + while ( dv == 0 || dv == 1 ) { + val = ( val << 1 ) + dv; + ch = ts_getc(); + dv = ch.digitValue(); + } + if ( ch != TQEOF ) + ts_ungetc( ch ); + return val; +} + +ulong TQTextStream::input_oct() +{ + ulong val = 0; + TQChar ch = eat_ws(); + int dv = ch.digitValue(); + while ( dv >= 0 && dv <= 7 ) { + val = ( val << 3 ) + dv; + ch = ts_getc(); + dv = ch.digitValue(); + } + if ( dv == 8 || dv == 9 ) { + while ( ts_isdigit(ch) ) + ch = ts_getc(); + } + if ( ch != TQEOF ) + ts_ungetc( ch ); + return val; +} + +ulong TQTextStream::input_dec() +{ + ulong val = 0; + TQChar ch = eat_ws(); + int dv = ch.digitValue(); + while ( ts_isdigit(ch) ) { + val = val * 10 + dv; + ch = ts_getc(); + dv = ch.digitValue(); + } + if ( ch != TQEOF ) + ts_ungetc( ch ); + return val; +} + +ulong TQTextStream::input_hex() +{ + ulong val = 0; + TQChar ch = eat_ws(); + char c = ch; + while ( isxdigit((uchar) c) ) { + val <<= 4; + if ( ts_isdigit(c) ) + val += c - '0'; + else + val += 10 + tolower( (uchar) c ) - 'a'; + c = ch = ts_getc(); + } + if ( ch != TQEOF ) + ts_ungetc( ch ); + return val; +} + +long TQTextStream::input_int() +{ + long val; + TQChar ch; + char c; + switch ( flags() & basefield ) { + case bin: + val = (long)input_bin(); + break; + case oct: + val = (long)input_oct(); + break; + case dec: + c = ch = eat_ws(); + if ( ch == TQEOF ) { + val = 0; + } else { + if ( !(c == '-' || c == '+') ) + ts_ungetc( ch ); + if ( c == '-' ) { + ulong v = input_dec(); + if ( v ) { // ensure that LONG_MIN can be read + v--; + val = -((long)v) - 1; + } else { + val = 0; + } + } else { + val = (long)input_dec(); + } + } + break; + case hex: + val = (long)input_hex(); + break; + default: + val = 0; + c = ch = eat_ws(); + if ( c == '0' ) { // bin, oct or hex + c = ch = ts_getc(); + if ( tolower((uchar) c) == 'x' ) + val = (long)input_hex(); + else if ( tolower((uchar) c) == 'b' ) + val = (long)input_bin(); + else { // octal + ts_ungetc( ch ); + if ( c >= '0' && c <= '7' ) { + val = (long)input_oct(); + } else { + val = 0; + } + } + } else if ( ts_isdigit(ch) ) { + ts_ungetc( ch ); + val = (long)input_dec(); + } else if ( c == '-' || c == '+' ) { + ulong v = input_dec(); + if ( c == '-' ) { + if ( v ) { // ensure that LONG_MIN can be read + v--; + val = -((long)v) - 1; + } else { + val = 0; + } + } else { + val = (long)v; + } + } + } + return val; +} + +// +// We use a table-driven FSM to parse floating point numbers +// strtod() cannot be used directly since we're reading from a TQIODevice +// + +double TQTextStream::input_double() +{ + const int Init = 0; // states + const int Sign = 1; + const int Mantissa = 2; + const int Dot = 3; + const int Abscissa = 4; + const int ExpMark = 5; + const int ExpSign = 6; + const int Exponent = 7; + const int Done = 8; + + const int InputSign = 1; // input tokens + const int InputDigit = 2; + const int InputDot = 3; + const int InputExp = 4; + + static const uchar table[8][5] = { + /* None InputSign InputDigit InputDot InputExp */ + { 0, Sign, Mantissa, Dot, 0, }, // Init + { 0, 0, Mantissa, Dot, 0, }, // Sign + { Done, Done, Mantissa, Dot, ExpMark,}, // Mantissa + { 0, 0, Abscissa, 0, 0, }, // Dot + { Done, Done, Abscissa, Done, ExpMark,}, // Abscissa + { 0, ExpSign, Exponent, 0, 0, }, // ExpMark + { 0, 0, Exponent, 0, 0, }, // ExpSign + { Done, Done, Exponent, Done, Done } // Exponent + }; + + int state = Init; // parse state + int input; // input token + + char buf[256]; + int i = 0; + TQChar c = eat_ws(); + + for (;;) { + + switch ( c ) { + case '+': + case '-': + input = InputSign; + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + input = InputDigit; + break; + case '.': + input = InputDot; + break; + case 'e': + case 'E': + input = InputExp; + break; + default: + input = 0; + break; + } + + state = table[state][input]; + + if ( state == 0 || state == Done || i > 250 ) { + if ( i > 250 ) { // ignore rest of digits + do { c = ts_getc(); } while ( c != TQEOF && ts_isdigit(c) ); + } + if ( c != TQEOF ) + ts_ungetc( c ); + buf[i] = '\0'; + char *end; + return strtod( buf, &end ); + } + + buf[i++] = c; + c = ts_getc(); + } + +#if !defined(Q_CC_EDG) + return 0.0; +#endif +} + + +/*! + \overload + + Reads a signed \c short integer \a i from the stream and returns a + reference to the stream. See flags() for an explanation of the + expected input format. +*/ + +TQTextStream &TQTextStream::operator>>( signed short &i ) +{ + CHECK_STREAM_PRECOND + i = (signed short)input_int(); + return *this; +} + + +/*! + \overload + + Reads an unsigned \c short integer \a i from the stream and + returns a reference to the stream. See flags() for an explanation + of the expected input format. +*/ + +TQTextStream &TQTextStream::operator>>( unsigned short &i ) +{ + CHECK_STREAM_PRECOND + i = (unsigned short)input_int(); + return *this; +} + + +/*! + \overload + + Reads a signed \c int \a i from the stream and returns a reference + to the stream. See flags() for an explanation of the expected + input format. +*/ + +TQTextStream &TQTextStream::operator>>( signed int &i ) +{ + CHECK_STREAM_PRECOND + i = (signed int)input_int(); + return *this; +} + + +/*! + \overload + + Reads an unsigned \c int \a i from the stream and returns a + reference to the stream. See flags() for an explanation of the + expected input format. +*/ + +TQTextStream &TQTextStream::operator>>( unsigned int &i ) +{ + CHECK_STREAM_PRECOND + i = (unsigned int)input_int(); + return *this; +} + + +/*! + \overload + + Reads a signed \c long int \a i from the stream and returns a + reference to the stream. See flags() for an explanation of the + expected input format. +*/ + +TQTextStream &TQTextStream::operator>>( signed long &i ) +{ + CHECK_STREAM_PRECOND + i = (signed long)input_int(); + return *this; +} + + +/*! + \overload + + Reads an unsigned \c long int \a i from the stream and returns a + reference to the stream. See flags() for an explanation of the + expected input format. +*/ + +TQTextStream &TQTextStream::operator>>( unsigned long &i ) +{ + CHECK_STREAM_PRECOND + i = (unsigned long)input_int(); + return *this; +} + + +/*! + \overload + + Reads a \c float \a f from the stream and returns a reference to + the stream. See flags() for an explanation of the expected input + format. +*/ + +TQTextStream &TQTextStream::operator>>( float &f ) +{ + CHECK_STREAM_PRECOND + f = (float)input_double(); + return *this; +} + + +/*! + \overload + + Reads a \c double \a f from the stream and returns a reference to + the stream. See flags() for an explanation of the expected input + format. +*/ + +TQTextStream &TQTextStream::operator>>( double &f ) +{ + CHECK_STREAM_PRECOND + f = input_double(); + return *this; +} + + +/*! + \overload + + Reads a "word" from the stream into \a s and returns a reference + to the stream. + + A word consists of characters for which isspace() returns FALSE. +*/ + +TQTextStream &TQTextStream::operator>>( char *s ) +{ + CHECK_STREAM_PRECOND + int maxlen = width( 0 ); + TQChar c = eat_ws(); + if ( !maxlen ) + maxlen = -1; + while ( c != TQEOF ) { + if ( ts_isspace(c) || maxlen-- == 0 ) { + ts_ungetc( c ); + break; + } + *s++ = c; + c = ts_getc(); + } + + *s = '\0'; + return *this; +} + +/*! + \overload + + Reads a "word" from the stream into \a str and returns a reference + to the stream. + + A word consists of characters for which isspace() returns FALSE. +*/ + +TQTextStream &TQTextStream::operator>>( TQString &str ) +{ + CHECK_STREAM_PRECOND + str=TQString::fromLatin1(""); + TQChar c = eat_ws(); + + while ( c != TQEOF ) { + if ( ts_isspace(c) ) { + ts_ungetc( c ); + break; + } + str += c; + c = ts_getc(); + } + return *this; +} + +/*! + \overload + + Reads a "word" from the stream into \a str and returns a reference + to the stream. + + A word consists of characters for which isspace() returns FALSE. +*/ + +TQTextStream &TQTextStream::operator>>( TQCString &str ) +{ + CHECK_STREAM_PRECOND + TQCString *dynbuf = 0; + const int buflen = 256; + char buffer[buflen]; + char *s = buffer; + int i = 0; + TQChar c = eat_ws(); + + while ( c != TQEOF ) { + if ( ts_isspace(c) ) { + ts_ungetc( c ); + break; + } + if ( i >= buflen-1 ) { + if ( !dynbuf ) { // create dynamic buffer + dynbuf = new TQCString(buflen*2); + memcpy( dynbuf->data(), s, i ); // copy old data + } else if ( i >= (int)dynbuf->size()-1 ) { + dynbuf->resize( dynbuf->size()*2 ); + } + s = dynbuf->data(); + } + s[i++] = c; + c = ts_getc(); + } + str.resize( i+1 ); + memcpy( str.data(), s, i ); + delete dynbuf; + return *this; +} + + +/*! + Reads a line from the stream and returns a string containing the + text. + + The returned string does not contain any trailing newline or + carriage return. Note that this is different from + TQIODevice::readLine(), which does not strip the newline at the end + of the line. + + On EOF you will get a TQString that is null. On reading an empty + line the returned TQString is empty but not null. + + \sa TQIODevice::readLine() +*/ + +TQString TQTextStream::readLine() +{ +#if defined(QT_CHECK_STATE) + if ( !dev ) { + tqWarning( "TQTextStream::readLine: No device" ); + return TQString::null; + } +#endif + bool readCharByChar = TRUE; + TQString result; +#if 0 + if ( !doUnicodeHeader && ( + (latin1) || + (mapper != 0 && mapper->mibEnum() == 106 ) // UTF 8 + ) ) { + readCharByChar = FALSE; + // use optimized read line + TQChar c[getline_buf_size]; + int pos = 0; + bool eof = FALSE; + + for (;;) { + pos = ts_getline( c ); + if ( pos == 0 ) { + // something went wrong; try fallback + readCharByChar = TRUE; + //dev->resetStatus(); + break; + } + if ( c[pos-1] == TQEOF || c[pos-1] == '\n' ) { + if ( pos>2 && c[pos-1]==TQEOF && c[pos-2]=='\n' ) { + result += TQString( c, pos-2 ); + } else if ( pos > 1 ) { + result += TQString( c, pos-1 ); + } + if ( pos == 1 && c[pos-1] == TQEOF ) + eof = TRUE; + break; + } else { + result += TQString( c, pos ); + } + } + if ( eof && result.isEmpty() ) + return TQString::null; + } +#endif + if ( readCharByChar ) { + const int buf_size = 256; + TQChar c[buf_size]; + int pos = 0; + + c[pos] = ts_getc(); + if ( c[pos] == TQEOF ) + return TQString::null; + + while ( c[pos] != TQEOF && c[pos] != '\n' ) { + if ( c[pos] == '\r' ) { // ( handle mac and dos ) + TQChar nextc = ts_getc(); + if ( nextc != '\n' ) + ts_ungetc( nextc ); + break; + } + pos++; + if ( pos >= buf_size ) { + result += TQString( c, pos ); + pos = 0; + } + c[pos] = ts_getc(); + } + result += TQString( c, pos ); + } + + return result; +} + + +/*! + Reads the entire stream from the current position, and returns a string + containing the text. + + \sa TQIODevice::readLine() +*/ + +TQString TQTextStream::read() +{ +#if defined(QT_CHECK_STATE) + if ( !dev ) { + tqWarning( "TQTextStream::read: No device" ); + return TQString::null; + } +#endif + TQString result; + const uint bufsize = 512; + TQChar buf[bufsize]; + uint i, num, start; + bool skipped_cr = FALSE; + + for (;;) { + num = ts_getbuf(buf,bufsize); + // convert dos (\r\n) and mac (\r) style eol to unix style (\n) + start = 0; + for ( i=0; i<num; i++ ) { + if ( buf[i] == '\r' ) { + // Only skip single cr's preceding lf's + if ( skipped_cr ) { + result += buf[i]; + start++; + } else { + result += TQString( &buf[start], i-start ); + start = i+1; + skipped_cr = TRUE; + } + } else { + if ( skipped_cr ) { + if ( buf[i] != '\n' ) { + // Should not have skipped it + result += '\n'; + } + skipped_cr = FALSE; + } + } + } + if ( start < num ) + result += TQString( &buf[start], i-start ); + if ( num != bufsize ) // if ( EOF ) + break; + } + return result; +} + + + +/***************************************************************************** + TQTextStream write functions + *****************************************************************************/ + +/*! + Writes character \c char to the stream and returns a reference to + the stream. + + The character \a c is assumed to be Latin1 encoded independent of + the Encoding set for the TQTextStream. +*/ +TQTextStream &TQTextStream::operator<<( TQChar c ) +{ + CHECK_STREAM_PRECOND + ts_putc( c ); + return *this; +} + +/*! + \overload + + Writes character \a c to the stream and returns a reference to the + stream. +*/ +TQTextStream &TQTextStream::operator<<( char c ) +{ + CHECK_STREAM_PRECOND + unsigned char uc = (unsigned char) c; + ts_putc( uc ); + return *this; +} + +TQTextStream &TQTextStream::output_int( int format, unsigned long long n, bool neg ) +{ + static const char hexdigits_lower[] = "0123456789abcdef"; + static const char hexdigits_upper[] = "0123456789ABCDEF"; + CHECK_STREAM_PRECOND + char buf[76]; + char *p; + int len; + const char *hexdigits; + + switch ( flags() & I_BASE_MASK ) { + + case I_BASE_2: // output binary number + switch ( format & I_TYPE_MASK ) { + case I_SHORT: len=16; break; + case I_INT: len=sizeof(int)*8; break; + case I_LONG: len=32; break; + case I_LONGLONG: len=64; break; + default: len = 0; + } + p = &buf[74]; // go reverse order + *p = '\0'; + while ( len-- ) { + *--p = (char)(n&1) + '0'; + n >>= 1; + if ( !n ) + break; + } + if ( flags() & showbase ) { // show base + *--p = (flags() & uppercase) ? 'B' : 'b'; + *--p = '0'; + } + break; + + case I_BASE_8: // output octal number + p = &buf[74]; + *p = '\0'; + do { + *--p = (char)(n&7) + '0'; + n >>= 3; + } while ( n ); + if ( flags() & showbase ) + *--p = '0'; + break; + + case I_BASE_16: // output hexadecimal number + p = &buf[74]; + *p = '\0'; + hexdigits = (flags() & uppercase) ? + hexdigits_upper : hexdigits_lower; + do { + *--p = hexdigits[(int)n&0xf]; + n >>= 4; + } while ( n ); + if ( flags() & showbase ) { + *--p = (flags() & uppercase) ? 'X' : 'x'; + *--p = '0'; + } + break; + + default: // decimal base is default + p = &buf[74]; + *p = '\0'; + if ( neg ) + n = (unsigned long long)(-(long long)n); + do { + *--p = ((int)(n%10)) + '0'; + n /= 10; + } while ( n ); + if ( neg ) + *--p = '-'; + else if ( flags() & showpos ) + *--p = '+'; + if ( (flags() & internal) && fwidth && !ts_isdigit(*p) ) { + ts_putc( *p ); // special case for internal + ++p; // padding + fwidth--; + return *this << (const char*)p; + } + } + if ( fwidth ) { // adjustment required + if ( !(flags() & left) ) { // but NOT left adjustment + len = tqstrlen(p); + int padlen = fwidth - len; + if ( padlen <= 0 ) { // no padding required + writeBlock( p, len ); + } else if ( padlen < (int)(p-buf) ) { // speeds up padding + memset( p-padlen, (char)fillchar, padlen ); + writeBlock( p-padlen, padlen+len ); + } + else // standard padding + *this << (const char*)p; + } + else + *this << (const char*)p; + fwidth = 0; // reset field width + } + else + writeBlock( p, tqstrlen(p) ); + return *this; +} + + +/*! + \overload + + Writes a \c short integer \a i to the stream and returns a + reference to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( signed short i ) +{ + return output_int( I_SHORT | I_SIGNED, i, i < 0 ); +} + + +/*! + \overload + + Writes an \c unsigned \c short integer \a i to the stream and + returns a reference to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( unsigned short i ) +{ + return output_int( I_SHORT | I_UNSIGNED, i, FALSE ); +} + + +/*! + \overload + + Writes an \c int \a i to the stream and returns a reference to the + stream. +*/ + +TQTextStream &TQTextStream::operator<<( signed int i ) +{ + return output_int( I_INT | I_SIGNED, i, i < 0 ); +} + + +/*! + \overload + + Writes an \c unsigned \c int \a i to the stream and returns a + reference to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( unsigned int i ) +{ + return output_int( I_INT | I_UNSIGNED, i, FALSE ); +} + + +/*! + \overload + + Writes a \c long \c int \a i to the stream and returns a reference + to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( signed long i ) +{ + return output_int( I_LONG | I_SIGNED, i, i < 0 ); +} + + +/*! + \overload + + Writes an \c unsigned \c long \c int \a i to the stream and + returns a reference to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( unsigned long i ) +{ + return output_int( I_LONG | I_UNSIGNED, i, FALSE ); +} + +/*! + \overload + + Writes a \c long long \c int \a i to the stream and returns a reference + to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( signed long long i ) +{ + return output_int( I_LONGLONG | I_SIGNED, i, i < 0 ); +} + + +/*! + \overload + + Writes an \c unsigned \c long \c int \a i to the stream and + returns a reference to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( unsigned long long i ) +{ + return output_int( I_LONGLONG | I_UNSIGNED, i, FALSE ); +} + + +/*! + \overload + + Writes a \c float \a f to the stream and returns a reference to + the stream. +*/ + +TQTextStream &TQTextStream::operator<<( float f ) +{ + return *this << (double)f; +} + +/*! + \overload + + Writes a \c double \a f to the stream and returns a reference to + the stream. +*/ + +TQTextStream &TQTextStream::operator<<( double f ) +{ + CHECK_STREAM_PRECOND + char f_char; + char format[16]; + if ( (flags()&floatfield) == fixed ) + f_char = 'f'; + else if ( (flags()&floatfield) == scientific ) + f_char = (flags() & uppercase) ? 'E' : 'e'; + else + f_char = (flags() & uppercase) ? 'G' : 'g'; + char *fs = format; // generate format string + *fs++ = '%'; // "%.<prec>l<f_char>" + *fs++ = '.'; + int prec = precision(); + if ( prec > 99 ) + prec = 99; + if ( prec >= 10 ) { + *fs++ = prec / 10 + '0'; + *fs++ = prec % 10 + '0'; + } else { + *fs++ = prec + '0'; + } + *fs++ = 'l'; + *fs++ = f_char; + *fs = '\0'; + TQString num; + num.sprintf(format, f); // convert to text + if ( fwidth ) // padding + *this << num.latin1(); + else // just write it + writeBlock(num.latin1(), num.length()); + return *this; +} + + +/*! + \overload + + Writes a string to the stream and returns a reference to the + stream. + + The string \a s is assumed to be Latin1 encoded independent of the + Encoding set for the TQTextStream. +*/ + +TQTextStream &TQTextStream::operator<<( const char* s ) +{ + CHECK_STREAM_PRECOND + char padbuf[48]; + uint len = tqstrlen( s ); // don't write null terminator + if ( fwidth ) { // field width set + int padlen = fwidth - len; + fwidth = 0; // reset width + if ( padlen > 0 ) { + char *ppad; + if ( padlen > 46 ) { // create extra big fill buffer + ppad = new char[padlen]; + TQ_CHECK_PTR( ppad ); + } else { + ppad = padbuf; + } + memset( ppad, (char)fillchar, padlen ); // fill with fillchar + if ( !(flags() & left) ) { + writeBlock( ppad, padlen ); + padlen = 0; + } + writeBlock( s, len ); + if ( padlen ) + writeBlock( ppad, padlen ); + if ( ppad != padbuf ) // delete extra big fill buf + delete[] ppad; + return *this; + } + } + writeBlock( s, len ); + return *this; +} + +/*! + \overload + + Writes \a s to the stream and returns a reference to the stream. + + The string \a s is assumed to be Latin1 encoded independent of the + Encoding set for the TQTextStream. +*/ + +TQTextStream &TQTextStream::operator<<( const TQCString & s ) +{ + return operator<<(s.data()); +} + +/*! + \overload + + Writes \a s to the stream and returns a reference to the stream. +*/ + +TQTextStream &TQTextStream::operator<<( const TQString& s ) +{ + if ( !mapper && latin1 ) + return operator<<(s.latin1()); + CHECK_STREAM_PRECOND + TQString s1 = s; + if ( fwidth ) { // field width set + if ( !(flags() & left) ) { + s1 = s.rightJustify(fwidth, (char)fillchar); + } else { + s1 = s.leftJustify(fwidth, (char)fillchar); + } + fwidth = 0; // reset width + } + writeBlock( s1.unicode(), s1.length() ); + return *this; +} + + +/*! + \overload + + Writes a pointer to the stream and returns a reference to the + stream. + + The \a ptr is output as an unsigned long hexadecimal integer. +*/ + +TQTextStream &TQTextStream::operator<<( void *ptr ) +{ + int f = flags(); + setf( hex, basefield ); + setf( showbase ); + unsetf( uppercase ); + output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE ); + flags( f ); + return *this; +} + + +/*! + \fn int TQTextStream::flags() const + + Returns the current stream flags. The default value is 0. + + \table + \header \i Flag \i Meaning + \row \i \c skipws \i Not currently used; whitespace always skipped + \row \i \c left \i Numeric fields are left-aligned + \row \i \c right + \i Not currently used (by default, numerics are right-aligned) + \row \i \c internal \i Puts any padding spaces between +/- and value + \row \i \c bin \i Output \e and input only in binary + \row \i \c oct \i Output \e and input only in octal + \row \i \c dec \i Output \e and input only in decimal + \row \i \c hex \i Output \e and input only in hexadecimal + \row \i \c showbase + \i Annotates numeric outputs with 0b, 0, or 0x if in \c bin, + \c oct, or \c hex format + \row \i \c showpoint \i Not currently used + \row \i \c uppercase \i Uses 0B and 0X rather than 0b and 0x + \row \i \c showpos \i Shows + for positive numeric values + \row \i \c scientific \i Uses scientific notation for floating point values + \row \i \c fixed \i Uses fixed-point notation for floating point values + \endtable + + Note that unless \c bin, \c oct, \c dec, or \c hex is set, the + input base is octal if the value starts with 0, hexadecimal if it + starts with 0x, binary if it starts with 0b, and decimal + otherwise. + + \sa setf(), unsetf() +*/ + +/*! + \fn int TQTextStream::flags( int f ) + + \overload + + Sets the stream flags to \a f. Returns the previous stream flags. + + \sa setf(), unsetf(), flags() +*/ + +/*! + \fn int TQTextStream::setf( int bits ) + + Sets the stream flag bits \a bits. Returns the previous stream + flags. + + Equivalent to \c{flags( flags() | bits )}. + + \sa setf(), unsetf() +*/ + +/*! + \fn int TQTextStream::setf( int bits, int mask ) + + \overload + + Sets the stream flag bits \a bits with a bit mask \a mask. Returns + the previous stream flags. + + Equivalent to \c{flags( (flags() & ~mask) | (bits & mask) )}. + + \sa setf(), unsetf() +*/ + +/*! + \fn int TQTextStream::unsetf( int bits ) + + Clears the stream flag bits \a bits. Returns the previous stream + flags. + + Equivalent to \c{flags( flags() & ~mask )}. + + \sa setf() +*/ + +/*! + \fn int TQTextStream::width() const + + Returns the field width. The default value is 0. +*/ + +/*! + \fn int TQTextStream::width( int w ) + + \overload + + Sets the field width to \a w. Returns the previous field width. +*/ + +/*! + \fn int TQTextStream::fill() const + + Returns the fill character. The default value is ' ' (space). +*/ + +/*! + \overload int TQTextStream::fill( int f ) + + Sets the fill character to \a f. Returns the previous fill character. +*/ + +/*! + \fn int TQTextStream::precision() const + + Returns the precision. The default value is 6. +*/ + +/*! + \fn int TQTextStream::precision( int p ) + + \overload + + Sets the precision to \a p. Returns the previous precision setting. +*/ + + + /***************************************************************************** + TQTextStream manipulators + *****************************************************************************/ + +TQTextStream &bin( TQTextStream &s ) +{ + s.setf(TQTS::bin,TQTS::basefield); + return s; +} + +TQTextStream &oct( TQTextStream &s ) +{ + s.setf(TQTS::oct,TQTS::basefield); + return s; +} + +TQTextStream &dec( TQTextStream &s ) +{ + s.setf(TQTS::dec,TQTS::basefield); + return s; +} + +TQTextStream &hex( TQTextStream &s ) +{ + s.setf(TQTS::hex,TQTS::basefield); + return s; +} + +TQTextStream &endl( TQTextStream &s ) +{ + return s << '\n'; +} + +TQTextStream &flush( TQTextStream &s ) +{ + if ( s.device() ) + s.device()->flush(); + return s; +} + +TQTextStream &ws( TQTextStream &s ) +{ + s.skipWhiteSpace(); + return s; +} + +TQTextStream &reset( TQTextStream &s ) +{ + s.reset(); + return s; +} + + +/*! + \class TQTextIStream tqtextstream.h + \reentrant + \brief The TQTextIStream class is a convenience class for input streams. + + \ingroup io + \ingroup text + + This class provides a shorthand for creating simple input + \l{TQTextStream}s without having to pass a \e mode argument to the + constructor. + + This class makes it easy, for example, to write things like this: + \code + TQString data = "123 456"; + int a, b; + TQTextIStream(&data) >> a >> b; + \endcode + + \sa TQTextOStream +*/ + +/*! + \fn TQTextIStream::TQTextIStream( const TQString *s ) + + Constructs a stream to read from the string \a s. +*/ +/*! + \fn TQTextIStream::TQTextIStream( TQByteArray ba ) + + Constructs a stream to read from the array \a ba. +*/ +/*! + \fn TQTextIStream::TQTextIStream( FILE *f ) + + Constructs a stream to read from the file \a f. +*/ + + +/*! + \class TQTextOStream + \reentrant + \brief The TQTextOStream class is a convenience class for output streams. + + \ingroup io + \ingroup text + + This class provides a shorthand for creating simple output + \l{TQTextStream}s without having to pass a \e mode argument to the + constructor. + + This makes it easy for example, to write things like this: + \code + TQString result; + TQTextOStream(&result) << "pi = " << 3.14; + \endcode +*/ + +/*! + \fn TQTextOStream::TQTextOStream( TQString *s ) + + Constructs a stream to write to string \a s. +*/ +/*! + \fn TQTextOStream::TQTextOStream( TQByteArray ba ) + + Constructs a stream to write to the array \a ba. +*/ +/*! + \fn TQTextOStream::TQTextOStream( FILE *f ) + + Constructs a stream to write to the file \a f. +*/ + + + +/*! + Sets the encoding of this stream to \a e, where \a e is one of the + following values: + \table + \header \i Encoding \i Meaning + \row \i Locale + \i Uses local file format (Latin1 if locale is not set), but + autodetecting Unicode(utf16) on input. + \row \i Unicode + \i Uses Unicode(utf16) for input and output. Output will be + written in the order most efficient for the current platform + (i.e. the order used internally in TQString). + \row \i UnicodeUTF8 + \i Using Unicode(utf8) for input and output. If you use it for + input it will autodetect utf16 and use it instead of utf8. + \row \i Latin1 + \i ISO-8859-1. Will not autodetect utf16. + \row \i UnicodeNetworkOrder + \i Uses network order Unicode(utf16) for input and output. + Useful when reading Unicode data that does not start with the + byte order marker. + \row \i UnicodeReverse + \i Uses reverse network order Unicode(utf16) for input and + output. Useful when reading Unicode data that does not start + with the byte order marker or when writing data that should be + read by buggy Windows applications. + \row \i RawUnicode + \i Like Unicode, but does not write the byte order marker nor + does it auto-detect the byte order. Useful only when writing to + non-persistent storage used by a single process. + \endtable + + \c Locale and all Unicode encodings, except \c RawUnicode, will look + at the first two bytes in an input stream to determine the byte + order. The initial byte order marker will be stripped off before + data is read. + + Note that this function should be called before any data is read to + or written from the stream. + + \sa setCodec() +*/ + +void TQTextStream::setEncoding( Encoding e ) +{ + if ( d->sourceType == TQTextStreamPrivate::String ) + return; + + switch ( e ) { + case Unicode: + mapper = 0; + latin1 = FALSE; + doUnicodeHeader = TRUE; + internalOrder = TRUE; + networkOrder = TQChar::networkOrdered(); + break; + case UnicodeUTF8: +#ifndef TQT_NO_TEXTCODEC + mapper = TQTextCodec::codecForMib( 106 ); + latin1 = FALSE; + doUnicodeHeader = TRUE; + internalOrder = TRUE; + networkOrder = TQChar::networkOrdered(); +#else + mapper = 0; + latin1 = TRUE; + doUnicodeHeader = TRUE; +#endif + break; + case UnicodeNetworkOrder: + mapper = 0; + latin1 = FALSE; + doUnicodeHeader = TRUE; + internalOrder = TQChar::networkOrdered(); + networkOrder = TRUE; + break; + case UnicodeReverse: + mapper = 0; + latin1 = FALSE; + doUnicodeHeader = TRUE; + internalOrder = !TQChar::networkOrdered(); + networkOrder = FALSE; + break; + case RawUnicode: + mapper = 0; + latin1 = FALSE; + doUnicodeHeader = FALSE; + internalOrder = TRUE; + networkOrder = TQChar::networkOrdered(); + break; + case Locale: + latin1 = TRUE; // fallback to Latin-1 +#ifndef TQT_NO_TEXTCODEC + mapper = TQTextCodec::codecForLocale(); + // optimized Latin-1 processing +#if defined(Q_OS_WIN32) + if ( GetACP() == 1252 ) + mapper = 0; +#endif + if ( mapper && mapper->mibEnum() == 4 ) +#endif + mapper = 0; + + doUnicodeHeader = TRUE; // If it reads as Unicode, accept it + break; + case Latin1: + mapper = 0; + doUnicodeHeader = FALSE; + latin1 = TRUE; + break; + } +} + + +#ifndef TQT_NO_TEXTCODEC +/*! + Sets the codec for this stream to \a codec. Will not try to + autodetect Unicode. + + Note that this function should be called before any data is read + to/written from the stream. + + \sa setEncoding(), codec() +*/ + +void TQTextStream::setCodec( TQTextCodec *codec ) +{ + if ( d->sourceType == TQTextStreamPrivate::String ) + return; // TQString does not need any codec + mapper = codec; + latin1 = ( codec->mibEnum() == 4 ); + if ( latin1 ) + mapper = 0; + doUnicodeHeader = FALSE; +} + +/*! + Returns the codec actually used for this stream. + + If Unicode is automatically detected in input, a codec with \link + TQTextCodec::name() name() \endlink "ISO-10646-UCS-2" is returned. + + \sa setCodec() +*/ + +TQTextCodec *TQTextStream::codec() +{ + if ( mapper ) { + return mapper; + } else { + // 4 is "ISO 8859-1", 1000 is "ISO-10646-UCS-2" + return TQTextCodec::codecForMib( latin1 ? 4 : 1000 ); + } +} + +#endif + +#endif // TQT_NO_TEXTSTREAM diff --git a/src/tools/tqtextstream.h b/src/tools/tqtextstream.h new file mode 100644 index 00000000..ab2366b3 --- /dev/null +++ b/src/tools/tqtextstream.h @@ -0,0 +1,341 @@ +/**************************************************************************** +** +** Definition of TQTextStream class +** +** Created : 940922 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the tools module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTSTREAM_H +#define TQTEXTSTREAM_H + +#ifndef QT_H +#include "ntqiodevice.h" +#include "tqstring.h" +#include <stdio.h> +#endif // QT_H + +#ifndef TQT_NO_TEXTSTREAM +class TQTextCodec; +class TQTextDecoder; + +class TQTextStreamPrivate; + +class TQ_EXPORT TQTextStream // text stream class +{ +public: + enum Encoding { Locale, Latin1, Unicode, UnicodeNetworkOrder, + UnicodeReverse, RawUnicode, UnicodeUTF8 }; + + void setEncoding( Encoding ); +#ifndef TQT_NO_TEXTCODEC + void setCodec( TQTextCodec* ); + TQTextCodec *codec(); +#endif + + TQTextStream(); + TQTextStream( TQIODevice * ); + TQTextStream( TQString*, int mode ); + TQTextStream( TQString&, int mode ); // obsolete + TQTextStream( TQByteArray, int mode ); + TQTextStream( FILE *, int mode ); + virtual ~TQTextStream(); + + TQIODevice *device() const; + void setDevice( TQIODevice * ); + void unsetDevice(); + + bool atEnd() const; + bool eof() const; + + TQTextStream &operator>>( TQChar & ); + TQTextStream &operator>>( char & ); + TQTextStream &operator>>( signed short & ); + TQTextStream &operator>>( unsigned short & ); + TQTextStream &operator>>( signed int & ); + TQTextStream &operator>>( unsigned int & ); + TQTextStream &operator>>( signed long & ); + TQTextStream &operator>>( unsigned long & ); + TQTextStream &operator>>( float & ); + TQTextStream &operator>>( double & ); + TQTextStream &operator>>( char * ); + TQTextStream &operator>>( TQString & ); + TQTextStream &operator>>( TQCString & ); + + TQTextStream &operator<<( TQChar ); + TQTextStream &operator<<( char ); + TQTextStream &operator<<( signed short ); + TQTextStream &operator<<( unsigned short ); + TQTextStream &operator<<( signed int ); + TQTextStream &operator<<( unsigned int ); + TQTextStream &operator<<( signed long ); + TQTextStream &operator<<( unsigned long ); + TQTextStream &operator<<( signed long long ); + TQTextStream &operator<<( unsigned long long ); + TQTextStream &operator<<( float ); + TQTextStream &operator<<( double ); + TQTextStream &operator<<( const char* ); + TQTextStream &operator<<( const TQString & ); + TQTextStream &operator<<( const TQCString & ); + TQTextStream &operator<<( void * ); // any pointer + + TQTextStream &readRawBytes( char *, uint len ); + TQTextStream &writeRawBytes( const char* , uint len ); + + TQString readLine(); + TQString read(); + void skipWhiteSpace(); + + enum { + skipws = 0x0001, // skip whitespace on input + left = 0x0002, // left-adjust output + right = 0x0004, // right-adjust output + internal = 0x0008, // pad after sign + bin = 0x0010, // binary format integer + oct = 0x0020, // octal format integer + dec = 0x0040, // decimal format integer + hex = 0x0080, // hex format integer + showbase = 0x0100, // show base indicator + showpoint = 0x0200, // force decimal point (float) + uppercase = 0x0400, // upper-case hex output + showpos = 0x0800, // add '+' to positive integers + scientific= 0x1000, // scientific float output + fixed = 0x2000 // fixed float output + }; + + static const int basefield; // bin | oct | dec | hex + static const int adjustfield; // left | right | internal + static const int floatfield; // scientific | fixed + + int flags() const; + int flags( int f ); + int setf( int bits ); + int setf( int bits, int mask ); + int unsetf( int bits ); + + void reset(); + + int width() const; + int width( int ); + int fill() const; + int fill( int ); + int precision() const; + int precision( int ); + +private: + long input_int(); + void init(); + TQTextStream &output_int( int, unsigned long long, bool ); + + TQIODevice *dev; + + int fflags; + int fwidth; + int fillchar; + int fprec; + bool doUnicodeHeader; + bool owndev; + TQTextCodec *mapper; + TQTextStreamPrivate * d; + TQChar unused1; // ### remove in TQt 4.0 + bool latin1; + bool internalOrder; + bool networkOrder; + void *unused2; // ### remove in TQt 4.0 + + TQChar eat_ws(); + uint ts_getline( TQChar* ); + void ts_ungetc( TQChar ); + TQChar ts_getc(); + uint ts_getbuf( TQChar*, uint ); + void ts_putc(int); + void ts_putc(TQChar); + bool ts_isspace(TQChar); + bool ts_isdigit(TQChar); + ulong input_bin(); + ulong input_oct(); + ulong input_dec(); + ulong input_hex(); + double input_double(); + TQTextStream &writeBlock( const char* p, uint len ); + TQTextStream &writeBlock( const TQChar* p, uint len ); + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQTextStream( const TQTextStream & ); + TQTextStream &operator=( const TQTextStream & ); +#endif +}; + +typedef TQTextStream TQTS; + +class TQ_EXPORT TQTextIStream : public TQTextStream { +public: + TQTextIStream( const TQString* s ) : + TQTextStream((TQString*)s,IO_ReadOnly) { } + TQTextIStream( TQByteArray ba ) : + TQTextStream(ba,IO_ReadOnly) { } + TQTextIStream( FILE *f ) : + TQTextStream(f,IO_ReadOnly) { } + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQTextIStream( const TQTextIStream & ); + TQTextIStream &operator=( const TQTextIStream & ); +#endif +}; + +class TQ_EXPORT TQTextOStream : public TQTextStream { +public: + TQTextOStream( TQString* s ) : + TQTextStream(s,IO_WriteOnly) { } + TQTextOStream( TQByteArray ba ) : + TQTextStream(ba,IO_WriteOnly) { } + TQTextOStream( FILE *f ) : + TQTextStream(f,IO_WriteOnly) { } + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQTextOStream( const TQTextOStream & ); + TQTextOStream &operator=( const TQTextOStream & ); +#endif +}; + +/***************************************************************************** + TQTextStream inline functions + *****************************************************************************/ + +inline TQIODevice *TQTextStream::device() const +{ return dev; } + +inline bool TQTextStream::atEnd() const +{ return dev ? dev->atEnd() : FALSE; } + +inline bool TQTextStream::eof() const +{ return atEnd(); } + +inline int TQTextStream::flags() const +{ return fflags; } + +inline int TQTextStream::flags( int f ) +{ int oldf = fflags; fflags = f; return oldf; } + +inline int TQTextStream::setf( int bits ) +{ int oldf = fflags; fflags |= bits; return oldf; } + +inline int TQTextStream::setf( int bits, int mask ) +{ int oldf = fflags; fflags = (fflags & ~mask) | (bits & mask); return oldf; } + +inline int TQTextStream::unsetf( int bits ) +{ int oldf = fflags; fflags &= ~bits; return oldf; } + +inline int TQTextStream::width() const +{ return fwidth; } + +inline int TQTextStream::width( int w ) +{ int oldw = fwidth; fwidth = w; return oldw; } + +inline int TQTextStream::fill() const +{ return fillchar; } + +inline int TQTextStream::fill( int f ) +{ int oldc = fillchar; fillchar = f; return oldc; } + +inline int TQTextStream::precision() const +{ return fprec; } + +inline int TQTextStream::precision( int p ) +{ int oldp = fprec; fprec = p; return oldp; } + +/*! + Returns one character from the stream, or EOF. +*/ +inline TQChar TQTextStream::ts_getc() +{ TQChar r; return ( ts_getbuf( &r,1 ) == 1 ? r : TQChar((ushort)0xffff) ); } + +/***************************************************************************** + TQTextStream manipulators + *****************************************************************************/ + +typedef TQTextStream & (*TQTSFUNC)(TQTextStream &);// manipulator function +typedef int (TQTextStream::*TQTSMFI)(int); // manipulator w/int argument + +class TQ_EXPORT TQTSManip { // text stream manipulator +public: + TQTSManip( TQTSMFI m, int a ) { mf=m; arg=a; } + void exec( TQTextStream &s ) { (s.*mf)(arg); } +private: + TQTSMFI mf; // TQTextStream member function + int arg; // member function argument +}; + +TQ_EXPORT inline TQTextStream &operator>>( TQTextStream &s, TQTSFUNC f ) +{ return (*f)( s ); } + +TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSFUNC f ) +{ return (*f)( s ); } + +TQ_EXPORT inline TQTextStream &operator<<( TQTextStream &s, TQTSManip m ) +{ m.exec(s); return s; } + +TQ_EXPORT TQTextStream &bin( TQTextStream &s ); // set bin notation +TQ_EXPORT TQTextStream &oct( TQTextStream &s ); // set oct notation +TQ_EXPORT TQTextStream &dec( TQTextStream &s ); // set dec notation +TQ_EXPORT TQTextStream &hex( TQTextStream &s ); // set hex notation +TQ_EXPORT TQTextStream &endl( TQTextStream &s ); // insert EOL ('\n') +TQ_EXPORT TQTextStream &flush( TQTextStream &s ); // flush output +TQ_EXPORT TQTextStream &ws( TQTextStream &s ); // eat whitespace on input +TQ_EXPORT TQTextStream &reset( TQTextStream &s ); // set default flags + +TQ_EXPORT inline TQTSManip qSetW( int w ) +{ + TQTSMFI func = &TQTextStream::width; + return TQTSManip(func,w); +} + +TQ_EXPORT inline TQTSManip qSetFill( int f ) +{ + TQTSMFI func = &TQTextStream::fill; + return TQTSManip(func,f); +} + +TQ_EXPORT inline TQTSManip qSetPrecision( int p ) +{ + TQTSMFI func = &TQTextStream::precision; + return TQTSManip(func,p); +} + +#endif // TQT_NO_TEXTSTREAM +#endif // TQTEXTSTREAM_H diff --git a/src/widgets/ntqdockarea.h b/src/widgets/ntqdockarea.h index 441f4b82..f70f61fe 100644 --- a/src/widgets/ntqdockarea.h +++ b/src/widgets/ntqdockarea.h @@ -48,7 +48,7 @@ #include "ntqlayout.h" #include "tqvaluelist.h" #include "ntqguardedptr.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #endif // QT_H #ifndef TQT_NO_MAINWINDOW diff --git a/src/widgets/ntqmainwindow.h b/src/widgets/ntqmainwindow.h index 73265436..548bbae8 100644 --- a/src/widgets/ntqmainwindow.h +++ b/src/widgets/ntqmainwindow.h @@ -45,7 +45,7 @@ #include "tqwidget.h" #include "ntqtoolbar.h" #include "tqptrlist.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #endif // QT_H #ifndef TQT_NO_MAINWINDOW diff --git a/src/widgets/ntqmultilineedit.h b/src/widgets/ntqmultilineedit.h index bbf22d8b..1f53dc38 100644 --- a/src/widgets/ntqmultilineedit.h +++ b/src/widgets/ntqmultilineedit.h @@ -42,7 +42,7 @@ #define TQMULTILINEEDIT_H #ifndef QT_H -#include "ntqtextedit.h" +#include "tqtextedit.h" #endif // QT_H #ifndef TQT_NO_MULTILINEEDIT diff --git a/src/widgets/ntqtextbrowser.h b/src/widgets/ntqtextbrowser.h deleted file mode 100644 index c9ac4ae9..00000000 --- a/src/widgets/ntqtextbrowser.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Definition of the TQTextBrowser class -** -** Created : 990101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTBROWSER_H -#define TQTEXTBROWSER_H - -#ifndef QT_H -#include "tqptrlist.h" -#include "ntqpixmap.h" -#include "ntqcolor.h" -#include "ntqtextedit.h" -#endif // QT_H - -#ifndef TQT_NO_TEXTBROWSER - -class TQTextBrowserData; - -class TQ_EXPORT TQTextBrowser : public TQTextEdit -{ - TQ_OBJECT - TQ_PROPERTY( TQString source READ source WRITE setSource ) - TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false ) - TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false ) - TQ_OVERRIDE( bool modified SCRIPTABLE false) - TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false ) - TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false ) - -public: - TQTextBrowser( TQWidget* parent=0, const char* name=0 ); - ~TQTextBrowser(); - - TQString source() const; - -public slots: - virtual void setSource(const TQString& name); - virtual void backward(); - virtual void forward(); - virtual void home(); - virtual void reload(); - void setText( const TQString &txt ) { setText( txt, TQString::null ); } - virtual void setText( const TQString &txt, const TQString &context ); - -signals: - void backwardAvailable( bool ); - void forwardAvailable( bool ); - void sourceChanged( const TQString& ); - void highlighted( const TQString& ); - void linkClicked( const TQString& ); - void anchorClicked( const TQString&, const TQString& ); - -protected: - void keyPressEvent( TQKeyEvent * e); - -private: - void popupDetail( const TQString& contents, const TQPoint& pos ); - bool linksEnabled() const { return TRUE; } - void emitHighlighted( const TQString &s ); - void emitLinkClicked( const TQString &s ); - TQTextBrowserData *d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQTextBrowser( const TQTextBrowser & ); - TQTextBrowser& operator=( const TQTextBrowser & ); -#endif -}; - -#endif // TQT_NO_TEXTBROWSER - -#endif // TQTEXTBROWSER_H diff --git a/src/widgets/ntqtextedit.h b/src/widgets/ntqtextedit.h deleted file mode 100644 index 40906dbf..00000000 --- a/src/widgets/ntqtextedit.h +++ /dev/null @@ -1,613 +0,0 @@ -/**************************************************************************** -** -** Definition of the TQTextEdit class -** -** Created : 990101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTEDIT_H -#define TQTEXTEDIT_H - -#ifndef QT_H -#include "ntqscrollview.h" -#include "ntqstylesheet.h" -#include "tqptrvector.h" -#include "tqvaluelist.h" -#include "tqptrlist.h" -#endif // QT_H - -#ifndef TQT_NO_TEXTEDIT -// uncomment below to enable optimization mode - also uncomment the -// optimDoAutoScroll() private slot since moc ignores #ifdefs.. -#define QT_TEXTEDIT_OPTIMIZATION - -class TQPainter; -class TQTextDocument; -class TQTextCursor; -class TQKeyEvent; -class TQResizeEvent; -class TQMouseEvent; -class TQTimer; -class TQTextString; -class TQTextCommand; -class TQTextParagraph; -class TQTextFormat; -class TQFont; -class TQColor; -class TQTextEdit; -class TQTextBrowser; -class TQTextString; -struct TQUndoRedoInfoPrivate; -class TQPopupMenu; -class TQTextEditPrivate; -class TQSyntaxHighlighter; - -#ifdef QT_TEXTEDIT_OPTIMIZATION -class TQTextEditOptimPrivate -{ -public: - // Note: no left-tag has any value for leftTag or parent, and - // no right-tag has any formatting flags set. - enum TagType { Color = 0, Format = 1 }; - struct Tag { - TagType type:2; - bool bold:1; - bool italic:1; - bool underline:1; - int line; - int index; - Tag * leftTag; // ptr to left-tag in a left-right tag pair - Tag * parent; // ptr to parent left-tag in a nested tag - Tag * prev; - Tag * next; - TQString tag; - }; - TQTextEditOptimPrivate() - { - len = numLines = maxLineWidth = 0; - selStart.line = selStart.index = -1; - selEnd.line = selEnd.index = -1; - search.line = search.index = 0; - tags = lastTag = 0; - } - void clearTags() - { - Tag * itr = tags; - while ( tags ) { - itr = tags; - tags = tags->next; - delete itr; - } - tags = lastTag = 0; - tagIndex.clear(); - } - ~TQTextEditOptimPrivate() - { - clearTags(); - } - int len; - int numLines; - int maxLineWidth; - struct Selection { - int line; - int index; - }; - Selection selStart, selEnd, search; - Tag * tags, * lastTag; - TQMap<int, TQString> lines; - TQMap<int, Tag *> tagIndex; -}; -#endif - -class TQ_EXPORT TQTextEdit : public TQScrollView -{ - friend class TQTextBrowser; - friend class TQSyntaxHighlighter; - - TQ_OBJECT - TQ_ENUMS( WordWrap WrapPolicy ) - TQ_SETS( AutoFormatting ) - TQ_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat ) - TQ_PROPERTY( TQString text READ text WRITE setText ) - TQ_PROPERTY( TQBrush paper READ paper WRITE setPaper ) - TQ_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline ) - TQ_PROPERTY( TQString documentTitle READ documentTitle ) - TQ_PROPERTY( int length READ length ) - TQ_PROPERTY( WordWrap wordWrap READ wordWrap WRITE setWordWrap ) - TQ_PROPERTY( int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth ) - TQ_PROPERTY( WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy ) - TQ_PROPERTY( bool hasSelectedText READ hasSelectedText ) - TQ_PROPERTY( TQString selectedText READ selectedText ) - TQ_PROPERTY( int undoDepth READ undoDepth WRITE setUndoDepth ) - TQ_PROPERTY( bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode ) - TQ_PROPERTY( bool modified READ isModified WRITE setModified DESIGNABLE false ) - TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) - TQ_PROPERTY( bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled ) - TQ_PROPERTY( int tabStopWidth READ tabStopWidth WRITE setTabStopWidth ) - TQ_PROPERTY( bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus ) - TQ_PROPERTY( AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting ) - -public: - enum WordWrap { - NoWrap, - WidgetWidth, - FixedPixelWidth, - FixedColumnWidth - }; - - enum WrapPolicy { - AtWordBoundary, - AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated - Anywhere, - AtWordOrDocumentBoundary - }; - - enum AutoFormatting { - AutoNone = 0, - AutoBulletList = 0x00000001, - AutoAll = 0xffffffff - }; - - enum KeyboardAction { - ActionBackspace, - ActionDelete, - ActionReturn, - ActionKill, - ActionWordBackspace, - ActionWordDelete - }; - - enum CursorAction { - MoveBackward, - MoveForward, - MoveWordBackward, - MoveWordForward, - MoveUp, - MoveDown, - MoveLineStart, - MoveLineEnd, - MoveHome, - MoveEnd, - MovePgUp, - MovePgDown - }; - - enum VerticalAlignment { - AlignNormal, - AlignSuperScript, - AlignSubScript - }; - - enum TextInsertionFlags { - RedoIndentation = 0x0001, - CheckNewLines = 0x0002, - RemoveSelected = 0x0004, - AsIMCompositionText = 0x0008, // internal use - WithIMSelection = 0x0010 // internal use - }; - - TQTextEdit( const TQString& text, const TQString& context = TQString::null, - TQWidget* parent=0, const char* name=0); - TQTextEdit( TQWidget* parent=0, const char* name=0 ); - virtual ~TQTextEdit(); - void setPalette( const TQPalette & ); - - TQString text() const; - TQString text( int para ) const; - TextFormat textFormat() const; - TQString context() const; - TQString documentTitle() const; - - void getSelection( int *paraFrom, int *indexFrom, - int *paraTo, int *indexTo, int selNum = 0 ) const; - virtual bool find( const TQString &expr, bool cs, bool wo, bool forward = TRUE, - int *para = 0, int *index = 0 ); - - int paragraphs() const; - int lines() const; - int linesOfParagraph( int para ) const; - int lineOfChar( int para, int chr ); - int length() const; - TQRect paragraphRect( int para ) const; - int paragraphAt( const TQPoint &pos ) const; - int charAt( const TQPoint &pos, int *para ) const; - int paragraphLength( int para ) const; - - TQStyleSheet* styleSheet() const; -#ifndef TQT_NO_MIME - TQMimeSourceFactory* mimeSourceFactory() const; -#endif - TQBrush paper() const; - bool linkUnderline() const; - - int heightForWidth( int w ) const; - - bool hasSelectedText() const; - TQString selectedText() const; - bool isUndoAvailable() const; - bool isRedoAvailable() const; - - WordWrap wordWrap() const; - int wrapColumnOrWidth() const; - WrapPolicy wrapPolicy() const; - - int tabStopWidth() const; - - TQString anchorAt( const TQPoint& pos ); - TQString anchorAt( const TQPoint& pos, AnchorAttribute a ); - - TQSize sizeHint() const; - - bool isReadOnly() const { return readOnly; } - - void getCursorPosition( int *parag, int *index ) const; - - bool isModified() const; - bool italic() const; - bool bold() const; - bool underline() const; - TQString family() const; - int pointSize() const; - TQColor color() const; - TQFont font() const; - TQFont currentFont() const; - int alignment() const; - int undoDepth() const; - - // do not use, will go away - virtual bool getFormat( int para, int index, TQFont *font, TQColor *color, VerticalAlignment *verticalAlignment ); - // do not use, will go away - virtual bool getParagraphFormat( int para, TQFont *font, TQColor *color, - VerticalAlignment *verticalAlignment, int *alignment, - TQStyleSheetItem::DisplayMode *displayMode, - TQStyleSheetItem::ListStyle *listStyle, - int *listDepth ); - - - bool isOverwriteMode() const { return overWrite; } - TQColor paragraphBackgroundColor( int para ) const; - - bool isUndoRedoEnabled() const; - bool eventFilter( TQObject *o, TQEvent *e ); - bool tabChangesFocus() const; - - void setAutoFormatting( uint features ); - uint autoFormatting() const; - TQSyntaxHighlighter *syntaxHighlighter() const; - -public slots: - void setEnabled( bool ); -#ifndef TQT_NO_MIME - virtual void setMimeSourceFactory( TQMimeSourceFactory* factory ); -#endif - virtual void setStyleSheet( TQStyleSheet* styleSheet ); - virtual void scrollToAnchor( const TQString& name ); - virtual void setPaper( const TQBrush& pap ); - virtual void setLinkUnderline( bool ); - - virtual void setWordWrap( WordWrap mode ); - virtual void setWrapColumnOrWidth( int ); - virtual void setWrapPolicy( WrapPolicy policy ); - - virtual void copy(); - virtual void append( const TQString& text ); - - void setText( const TQString &txt ) { setText( txt, TQString::null ); } - virtual void setText( const TQString &txt, const TQString &context ); - virtual void setTextFormat( TextFormat f ); - - virtual void selectAll( bool select = TRUE ); - virtual void setTabStopWidth( int ts ); - virtual void zoomIn( int range ); - virtual void zoomIn() { zoomIn( 1 ); } - virtual void zoomOut( int range ); - virtual void zoomOut() { zoomOut( 1 ); } - virtual void zoomTo( int size ); - - virtual void sync(); - virtual void setReadOnly( bool b ); - - virtual void undo(); - virtual void redo(); - virtual void cut(); - virtual void paste(); -#ifndef TQT_NO_CLIPBOARD - virtual void pasteSubType( const TQCString &subtype ); -#endif - virtual void clear(); - virtual void del(); - virtual void indent(); - virtual void setItalic( bool b ); - virtual void setBold( bool b ); - virtual void setUnderline( bool b ); - virtual void setFamily( const TQString &f ); - virtual void setPointSize( int s ); - virtual void setColor( const TQColor &c ); - virtual void setFont( const TQFont &f ); - virtual void setVerticalAlignment( VerticalAlignment a ); - virtual void setAlignment( int a ); - - // do not use, will go away - virtual void setParagType( TQStyleSheetItem::DisplayMode dm, TQStyleSheetItem::ListStyle listStyle ); - - virtual void setCursorPosition( int parag, int index ); - virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 ); - virtual void setSelectionAttributes( int selNum, const TQColor &back, bool invertText ); - virtual void setModified( bool m ); - virtual void resetFormat(); - virtual void setUndoDepth( int d ); - virtual void setFormat( TQTextFormat *f, int flags ); - virtual void ensureCursorVisible(); - virtual void placeCursor( const TQPoint &pos, TQTextCursor *c = 0 ); - virtual void moveCursor( CursorAction action, bool select ); - virtual void doKeyboardAction( KeyboardAction action ); - virtual void removeSelectedText( int selNum = 0 ); - virtual void removeSelection( int selNum = 0 ); - virtual void setCurrentFont( const TQFont &f ); - virtual void setOverwriteMode( bool b ) { overWrite = b; } - - virtual void scrollToBottom(); - - void insert( const TQString &text, uint insertionFlags = CheckNewLines | RemoveSelected ); // ## virtual in 4.0 - - // obsolete - virtual void insert( const TQString &text, bool, bool = TRUE, bool = TRUE ); - - virtual void insertAt( const TQString &text, int para, int index ); - virtual void removeParagraph( int para ); - virtual void insertParagraph( const TQString &text, int para ); - - virtual void setParagraphBackgroundColor( int para, const TQColor &bg ); - virtual void clearParagraphBackground( int para ); - - virtual void setUndoRedoEnabled( bool b ); - void setTabChangesFocus( bool b ); // ### make virtual in 4.0 - -#ifdef QT_TEXTEDIT_OPTIMIZATION - void polish(); - void setMaxLogLines( int numLines ); - int maxLogLines(); -#endif - -signals: - void textChanged(); - void selectionChanged(); - void copyAvailable( bool ); - void undoAvailable( bool yes ); - void redoAvailable( bool yes ); - void currentFontChanged( const TQFont &f ); - void currentColorChanged( const TQColor &c ); - void currentAlignmentChanged( int a ); - void currentVerticalAlignmentChanged( VerticalAlignment a ); - void cursorPositionChanged( TQTextCursor *c ); - void cursorPositionChanged( int para, int pos ); - void returnPressed(); - void modificationChanged( bool m ); - void clicked( int parag, int index ); - void doubleClicked( int parag, int index ); - -protected: - void repaintChanged(); - void updateStyles(); - void drawContents( TQPainter *p, int cx, int cy, int cw, int ch ); - bool event( TQEvent *e ); - void keyPressEvent( TQKeyEvent *e ); - void resizeEvent( TQResizeEvent *e ); - void viewportResizeEvent( TQResizeEvent* ); - void contentsMousePressEvent( TQMouseEvent *e ); - void contentsMouseMoveEvent( TQMouseEvent *e ); - void contentsMouseReleaseEvent( TQMouseEvent *e ); - void contentsMouseDoubleClickEvent( TQMouseEvent *e ); -#ifndef TQT_NO_WHEELEVENT - void contentsWheelEvent( TQWheelEvent *e ); -#endif - void imStartEvent( TQIMEvent * ); - void imComposeEvent( TQIMEvent * ); - void imEndEvent( TQIMEvent * ); -#ifndef TQT_NO_DRAGANDDROP - void contentsDragEnterEvent( TQDragEnterEvent *e ); - void contentsDragMoveEvent( TQDragMoveEvent *e ); - void contentsDragLeaveEvent( TQDragLeaveEvent *e ); - void contentsDropEvent( TQDropEvent *e ); -#endif - void contentsContextMenuEvent( TQContextMenuEvent *e ); - bool sendMouseEventToInputContext( TQMouseEvent *e ); - bool focusNextPrevChild( bool next ); - TQTextDocument *document() const; - TQTextCursor *textCursor() const; - void setDocument( TQTextDocument *doc ); - virtual TQPopupMenu *createPopupMenu( const TQPoint& pos ); - virtual TQPopupMenu *createPopupMenu(); - void drawCursor( bool visible ); - - void windowActivationChange( bool ); - -protected slots: - virtual void doChangeInterval(); - void sliderReleased(); // ### make virtual in 4.0 - -private slots: - void formatMore(); - void doResize(); - void autoScrollTimerDone(); - void blinkCursor(); - void setModified(); - void startDrag(); - void documentWidthChanged( int w ); - void clipboardChanged(); - -private: - struct TQ_EXPORT UndoRedoInfo { - enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style, IME }; - - UndoRedoInfo( TQTextDocument *dc ); - ~UndoRedoInfo(); - void clear(); - bool valid() const; - - TQUndoRedoInfoPrivate *d; - int id; - int index; - int eid; - int eindex; - TQTextFormat *format; - int flags; - Type type; - TQTextDocument *doc; - TQByteArray styleInformation; - }; - -private: - void updateCursor( const TQPoint & pos ); - void handleMouseMove( const TQPoint& pos ); - void drawContents( TQPainter * ); - virtual bool linksEnabled() const { return FALSE; } - void init(); - void checkUndoRedoInfo( UndoRedoInfo::Type t ); - void updateCurrentFormat(); - bool handleReadOnlyKeyEvent( TQKeyEvent *e ); - void makeParagVisible( TQTextParagraph *p ); - void normalCopy(); - void copyToClipboard(); -#ifndef TQT_NO_MIME - TQCString pickSpecial(TQMimeSource* ms, bool always_ask, const TQPoint&); - TQTextDrag *dragObject( TQWidget *parent = 0 ) const; -#endif -#ifndef TQT_NO_MIMECLIPBOARD - void pasteSpecial(const TQPoint&); -#endif - void setFontInternal( const TQFont &f ); - - virtual void emitHighlighted( const TQString & ) {} - virtual void emitLinkClicked( const TQString & ) {} - - void readFormats( TQTextCursor &c1, TQTextCursor &c2, TQTextString &text, bool fillStyles = FALSE ); - void clearUndoRedo(); - void paintDocument( bool drawAll, TQPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 ); - void moveCursor( CursorAction action ); - void ensureFormatted( TQTextParagraph *p ); - void placeCursor( const TQPoint &pos, TQTextCursor *c, bool link ); - void updateMicroFocusHint(); - -#ifdef QT_TEXTEDIT_OPTIMIZATION - bool checkOptimMode(); - TQString optimText() const; - void optimSetText( const TQString &str ); - void optimAppend( const TQString &str ); - void optimInsert( const TQString &str, int line, int index ); - void optimDrawContents( TQPainter * p, int cx, int cy, int cw, int ch ); - void optimMousePressEvent( TQMouseEvent * e ); - void optimMouseReleaseEvent( TQMouseEvent * e ); - void optimMouseMoveEvent( TQMouseEvent * e ); - int optimCharIndex( const TQString &str, int mx ) const; - void optimSelectAll(); - void optimRemoveSelection(); - void optimSetSelection( int startLine, int startIdx, int endLine, - int endIdx ); - bool optimHasSelection() const; - TQString optimSelectedText() const; - bool optimFind( const TQString & str, bool, bool, bool, int *, int * ); - void optimParseTags( TQString * str, int lineNo = -1, int indexOffset = 0 ); - TQTextEditOptimPrivate::Tag * optimPreviousLeftTag( int line ); - void optimSetTextFormat( TQTextDocument *, TQTextCursor *, TQTextFormat * f, - int, int, TQTextEditOptimPrivate::Tag * t ); - TQTextEditOptimPrivate::Tag * optimAppendTag( int index, const TQString & tag ); - TQTextEditOptimPrivate::Tag * optimInsertTag( int line, int index, const TQString & tag ); - void optimCheckLimit( const TQString& str ); - bool optimHasBoldMetrics( int line ); - -private slots: - void optimDoAutoScroll(); -#endif // QT_TEXTEDIT_OPTIMIZATION - -private: -#ifndef TQT_NO_CLIPBOARD - void pasteSubType( const TQCString &subtype, TQMimeSource *m ); -#endif - -private: - TQTextDocument *doc; - TQTextCursor *cursor; - TQTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer; - TQTextParagraph *lastFormatted; - int interval; - UndoRedoInfo undoRedoInfo; - TQTextFormat *currentFormat; - int currentAlignment; - TQPoint oldMousePos, mousePos; - TQPoint dragStartPos; - TQString onLink; - WordWrap wrapMode; - WrapPolicy wPolicy; - int wrapWidth; - TQString pressedLink; - TQTextEditPrivate *d; - bool inDoubleClick : 1; - bool mousePressed : 1; - bool cursorVisible : 1; - bool blinkCursorVisible : 1; - bool noop: 1; //< Removed; keep as padding for binary compat or reuse if needed - bool modified : 1; - bool mightStartDrag : 1; - bool inDnD : 1; - bool readOnly : 1; - bool undoEnabled : 1; - bool overWrite : 1; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQTextEdit( const TQTextEdit & ); - TQTextEdit &operator=( const TQTextEdit & ); -#endif -}; - -inline TQTextDocument *TQTextEdit::document() const -{ - return doc; -} - -inline TQTextCursor *TQTextEdit::textCursor() const -{ - return cursor; -} - -inline void TQTextEdit::setCurrentFont( const TQFont &f ) -{ - TQTextEdit::setFontInternal( f ); -} - -#endif //TQT_NO_TEXTEDIT -#endif //TQTEXTVIEW_H diff --git a/src/widgets/ntqtextview.h b/src/widgets/ntqtextview.h deleted file mode 100644 index 2d0d73cf..00000000 --- a/src/widgets/ntqtextview.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Definition of the TQTextView class -** -** Created : 990101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQTEXTVIEW_H -#define TQTEXTVIEW_H - -#ifndef QT_H -#include "ntqtextedit.h" -#endif // QT_H - -#ifndef TQT_NO_TEXTVIEW - -class TQ_EXPORT TQTextView : public TQTextEdit -{ - TQ_OBJECT - TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false ) - TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false ) - TQ_OVERRIDE( bool modified SCRIPTABLE false) - TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false ) - TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false ) - -public: - TQTextView( const TQString& text, const TQString& context = TQString::null, - TQWidget* parent=0, const char* name=0); - TQTextView( TQWidget* parent=0, const char* name=0 ); - - virtual ~TQTextView(); - -private: -#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator= - TQTextView( const TQTextView & ); - TQTextView &operator=( const TQTextView & ); -#endif -}; - -#endif //TQT_NO_TEXTVIEW -#endif //TQTEXTVIEW_H diff --git a/src/widgets/qcheckbox.cpp b/src/widgets/qcheckbox.cpp index 970ed578..0ef6529b 100644 --- a/src/widgets/qcheckbox.cpp +++ b/src/widgets/qcheckbox.cpp @@ -45,7 +45,7 @@ #include "ntqpixmap.h" #include "ntqpixmapcache.h" #include "ntqbitmap.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqapplication.h" #include "ntqstyle.h" diff --git a/src/widgets/qiconview.cpp b/src/widgets/qiconview.cpp index 36e1529c..71baf927 100644 --- a/src/widgets/qiconview.cpp +++ b/src/widgets/qiconview.cpp @@ -59,7 +59,7 @@ #include "ntqtimer.h" #include "ntqcursor.h" #include "ntqapplication.h" -#include "ntqtextedit.h" +#include "tqtextedit.h" #include "ntqmemarray.h" #include "tqptrlist.h" #include "ntqvbox.h" diff --git a/src/widgets/qlineedit.cpp b/src/widgets/qlineedit.cpp index 6ed13372..3894e35e 100644 --- a/src/widgets/qlineedit.cpp +++ b/src/widgets/qlineedit.cpp @@ -61,7 +61,7 @@ #include "ntqstyle.h" #include "ntqwhatsthis.h" #include "../kernel/qinternal_p.h" -#include "private/qtextlayout_p.h" +#include "private/tqtextlayout_p.h" #include "tqvaluevector.h" #if defined(Q_OS_LINUX) #include <sys/mman.h> diff --git a/src/widgets/qradiobutton.cpp b/src/widgets/qradiobutton.cpp index f6e48df6..b5de6b8d 100644 --- a/src/widgets/qradiobutton.cpp +++ b/src/widgets/qradiobutton.cpp @@ -46,7 +46,7 @@ #include "ntqpixmap.h" #include "ntqpixmapcache.h" #include "ntqbitmap.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqapplication.h" #include "ntqstyle.h" diff --git a/src/widgets/qsyntaxhighlighter.cpp b/src/widgets/qsyntaxhighlighter.cpp index 814cc5a9..8cd8ba2a 100644 --- a/src/widgets/qsyntaxhighlighter.cpp +++ b/src/widgets/qsyntaxhighlighter.cpp @@ -43,7 +43,7 @@ #ifndef TQT_NO_SYNTAXHIGHLIGHTER #include "../kernel/qrichtext_p.h" -#include "ntqtextedit.h" +#include "tqtextedit.h" #include "ntqtimer.h" /*! diff --git a/src/widgets/qt_widgets.pri b/src/widgets/qt_widgets.pri index 8be28d1c..263c0e47 100644 --- a/src/widgets/qt_widgets.pri +++ b/src/widgets/qt_widgets.pri @@ -59,9 +59,9 @@ widgets { $$WIDGETS_H/tqwidgetstack.h \ $$WIDGETS_H/ntqaction.h \ $$WIDGETS_H/ntqdatetimeedit.h \ - $$WIDGETS_H/ntqtextview.h \ - $$WIDGETS_H/ntqtextbrowser.h \ - $$WIDGETS_H/ntqtextedit.h \ + $$WIDGETS_H/tqtextview.h \ + $$WIDGETS_H/tqtextbrowser.h \ + $$WIDGETS_H/tqtextedit.h \ $$WIDGETS_P/tqwidgetinterface_p.h \ $$WIDGETS_H/tqwidgetplugin.h @@ -122,9 +122,9 @@ widgets { $$WIDGETS_CPP/qaction.cpp \ $$WIDGETS_CPP/qdatetimeedit.cpp \ $$WIDGETS_CPP/qeffects.cpp \ - $$WIDGETS_CPP/qtextview.cpp \ - $$WIDGETS_CPP/qtextbrowser.cpp \ - $$WIDGETS_CPP/qtextedit.cpp \ + $$WIDGETS_CPP/tqtextview.cpp \ + $$WIDGETS_CPP/tqtextbrowser.cpp \ + $$WIDGETS_CPP/tqtextedit.cpp \ $$WIDGETS_CPP/tqwidgetplugin.cpp !embedded:mac:SOURCES += $$WIDGETS_CPP/qmenubar_mac.cpp } diff --git a/src/widgets/qtextbrowser.cpp b/src/widgets/qtextbrowser.cpp deleted file mode 100644 index 23b2452f..00000000 --- a/src/widgets/qtextbrowser.cpp +++ /dev/null @@ -1,555 +0,0 @@ -/**************************************************************************** -** -** Implementation of the TQTextBrowser class -** -** Created : 990101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqtextbrowser.h" -#ifndef TQT_NO_TEXTBROWSER -#include "../kernel/qrichtext_p.h" - -#include "ntqapplication.h" -#include "ntqlayout.h" -#include "ntqpainter.h" - -#include "tqvaluestack.h" -#include "stdio.h" -#include "ntqfile.h" -#include "ntqtextstream.h" -#include "ntqlayout.h" -#include "ntqbitmap.h" -#include "ntqtimer.h" -#include "tqimage.h" -#include "ntqsimplerichtext.h" -#include "ntqdragobject.h" -#include "ntqurl.h" -#include "ntqcursor.h" - -/*! - \class TQTextBrowser ntqtextbrowser.h - \brief The TQTextBrowser class provides a rich text browser with hypertext navigation. - - \ingroup advanced - \ingroup helpsystem - \ingroup text - \mainclass - - This class extends TQTextEdit (in read-only mode), adding some - navigation functionality so that users can follow links in - hypertext documents. The contents of TQTextEdit is set with - setText(), but TQTextBrowser has an additional function, - setSource(), which makes it possible to set the text to a named - document. The name is looked up in the text view's mime source - factory. If a document name ends with an anchor (for example, "\c - #anchor"), the text browser automatically scrolls to that position - (using scrollToAnchor()). When the user clicks on a hyperlink, the - browser will call setSource() itself, with the link's \c href - value as argument. You can track the current source by connetion - to the sourceChanged() signal. - - TQTextBrowser provides backward() and forward() slots which you can - use to implement Back and Forward buttons. The home() slot sets - the text to the very first document displayed. The linkClicked() - signal is emitted when the user clicks a link. - - By using TQTextEdit::setMimeSourceFactory() you can provide your - own subclass of TQMimeSourceFactory. This makes it possible to - access data from anywhere, for example from a network or from a - database. See TQMimeSourceFactory::data() for details. - - If you intend using the mime factory to read the data directly - from the file system, you may have to specify the encoding for the - file extension you are using. For example: - \code - mimeSourceFactory()->setExtensionType("qml", "text/utf8"); - \endcode - This is to ensure that the factory is able to resolve the document - names. - - TQTextBrowser interprets the tags it processes in accordance with - the default style sheet. Change the style sheet with - \l{setStyleSheet()}; see TQStyleSheet for details. - - If you want to provide your users with editable rich text use - TQTextEdit. If you want a text browser without hypertext navigation - use TQTextEdit, and use TQTextEdit::setReadOnly() to disable - editing. If you just need to display a small piece of rich text - use TQSimpleRichText or TQLabel. - - <img src=qtextbrowser-m.png> <img src=qtextbrowser-w.png> -*/ - -class TQTextBrowserData -{ -public: - TQTextBrowserData():textOrSourceChanged(FALSE) {} - - TQValueStack<TQString> stack; - TQValueStack<TQString> forwardStack; - TQString home; - TQString curmain; - TQString curmark; - - /*flag necessary to give the linkClicked() signal some meaningful - semantics when somebody connected to it calls setText() or - setSource() */ - bool textOrSourceChanged; -}; - - -/*! - Constructs an empty TQTextBrowser called \a name, with parent \a - parent. -*/ -TQTextBrowser::TQTextBrowser(TQWidget *parent, const char *name) - : TQTextEdit( parent, name ) -{ - setReadOnly( TRUE ); - d = new TQTextBrowserData; - - viewport()->setMouseTracking( TRUE ); -} - -/*! - \reimp -*/ -TQTextBrowser::~TQTextBrowser() -{ - delete d; -} - - -/*! - \property TQTextBrowser::source - \brief the name of the displayed document. - - This is a TQString::null if no document is displayed or if the - source is unknown. - - Setting this property uses the mimeSourceFactory() to lookup the - named document. It also checks for optional anchors and scrolls - the document accordingly. - - If the first tag in the document is \c{<qt type=detail>}, the - document is displayed as a popup rather than as new document in - the browser window itself. Otherwise, the document is displayed - normally in the text browser with the text set to the contents of - the named document with setText(). - - If you are using the filesystem access capabilities of the mime - source factory, you must ensure that the factory knows about the - encoding of specified files; otherwise no data will be available. - The default factory handles a couple of common file extensions - such as \c *.html and \c *.txt with reasonable defaults. See - TQMimeSourceFactory::data() for details. -*/ - -TQString TQTextBrowser::source() const -{ - if ( d->stack.isEmpty() ) - return TQString::null; - else - return d->stack.top(); -} - -/*! - \property TQTextBrowser::undoDepth - \brief This text browser's undo depth. -*/ - -/*! - \property TQTextBrowser::overwriteMode - \brief This text browser's overwrite mode. -*/ - -/*! - \property TQTextBrowser::modified - \brief Whether the contents have been modified. -*/ - -/*! - \property TQTextBrowser::readOnly - \brief Whether the contents are read only. -*/ - -/*! - \property TQTextBrowser::undoRedoEnabled - \brief Whether undo and redo are enabled. -*/ - - - -/*! - Reloads the current set source. -*/ - -void TQTextBrowser::reload() -{ - TQString s = d->curmain; - d->curmain = ""; - setSource( s ); -} - - -void TQTextBrowser::setSource(const TQString& name) -{ -#ifndef TQT_NO_CURSOR - if ( isVisible() ) - tqApp->setOverrideCursor( waitCursor ); -#endif - d->textOrSourceChanged = TRUE; - TQString source = name; - TQString mark; - int hash = name.find('#'); - if ( hash != -1) { - source = name.left( hash ); - mark = name.mid( hash+1 ); - } - - if ( source.left(5) == "file:" ) - source = source.mid(6); - - TQString url = mimeSourceFactory()->makeAbsolute( source, context() ); - TQString txt; - bool dosettext = FALSE; - - if ( !source.isEmpty() && url != d->curmain ) { - const TQMimeSource* m = - mimeSourceFactory()->data( source, context() ); - if ( !m ){ - tqWarning("TQTextBrowser: no mimesource for %s", source.latin1() ); - } - else { - if ( !TQTextDrag::decode( m, txt ) ) { - tqWarning("TQTextBrowser: cannot decode %s", source.latin1() ); - } - } - if ( isVisible() ) { - TQString firstTag = txt.left( txt.find( '>' ) + 1 ); - if ( firstTag.left( 3 ) == "<qt" && firstTag.contains( "type" ) && firstTag.contains( "detail" ) ) { - popupDetail( txt, TQCursor::pos() ); -#ifndef TQT_NO_CURSOR - tqApp->restoreOverrideCursor(); -#endif - return; - } - } - - d->curmain = url; - dosettext = TRUE; - } - - d->curmark = mark; - - if ( !mark.isEmpty() ) { - url += "#"; - url += mark; - } - if ( !d->home ) - d->home = url; - - if ( d->stack.isEmpty() || d->stack.top() != url) - d->stack.push( url ); - - int stackCount = (int)d->stack.count(); - if ( d->stack.top() == url ) - stackCount--; - emit backwardAvailable( stackCount > 0 ); - stackCount = (int)d->forwardStack.count(); - if ( d->forwardStack.isEmpty() || d->forwardStack.top() == url ) - stackCount--; - emit forwardAvailable( stackCount > 0 ); - - if ( dosettext ) - TQTextEdit::setText( txt, url ); - - if ( !mark.isEmpty() ) - scrollToAnchor( mark ); - else - setContentsPos( 0, 0 ); - -#ifndef TQT_NO_CURSOR - if ( isVisible() ) - tqApp->restoreOverrideCursor(); -#endif - - emit sourceChanged( url ); -} - -/*! - \fn void TQTextBrowser::backwardAvailable(bool available) - - This signal is emitted when the availability of backward() - changes. \a available is FALSE when the user is at home(); - otherwise it is TRUE. -*/ - -/*! - \fn void TQTextBrowser::forwardAvailable(bool available) - - This signal is emitted when the availability of forward() changes. - \a available is TRUE after the user navigates backward() and FALSE - when the user navigates or goes forward(). -*/ - -/*! - \fn void TQTextBrowser::sourceChanged( const TQString& src) - - This signal is emitted when the mime source has changed, \a src - being the new source. - - Source changes happen both programmatically when calling - setSource(), forward(), backword() or home() or when the user - clicks on links or presses the equivalent key sequences. -*/ - -/*! \fn void TQTextBrowser::highlighted (const TQString &link) - - This signal is emitted when the user has selected but not - activated a link in the document. \a link is the value of the \c - href i.e. the name of the target document. -*/ - -/*! - \fn void TQTextBrowser::linkClicked( const TQString& link) - - This signal is emitted when the user clicks a link. The \a link is - the value of the \c href i.e. the name of the target document. - - The \a link will be the absolute location of the document, based - on the value of the anchor's href tag and the current context of - the document. - - \sa anchorClicked(), context() -*/ - -/*! - \fn void TQTextBrowser::anchorClicked( const TQString& name, const TQString &link) - - This signal is emitted when the user clicks an anchor. The \a link is - the value of the \c href i.e. the name of the target document. The \a name - is the name of the anchor. - - \sa linkClicked() -*/ - -/*! - Changes the document displayed to the previous document in the - list of documents built by navigating links. Does nothing if there - is no previous document. - - \sa forward(), backwardAvailable() -*/ -void TQTextBrowser::backward() -{ - if ( d->stack.count() <= 1) - return; - d->forwardStack.push( d->stack.pop() ); - setSource( d->stack.pop() ); - emit forwardAvailable( TRUE ); -} - -/*! - Changes the document displayed to the next document in the list of - documents built by navigating links. Does nothing if there is no - next document. - - \sa backward(), forwardAvailable() -*/ -void TQTextBrowser::forward() -{ - if ( d->forwardStack.isEmpty() ) - return; - setSource( d->forwardStack.pop() ); - emit forwardAvailable( !d->forwardStack.isEmpty() ); -} - -/*! - Changes the document displayed to be the first document the - browser displayed. -*/ -void TQTextBrowser::home() -{ - if (!d->home.isNull() ) - setSource( d->home ); -} - -/*! - The event \a e is used to provide the following keyboard shortcuts: - \table - \header \i Keypress \i Action - \row \i Alt+Left Arrow \i \l backward() - \row \i Alt+Right Arrow \i \l forward() - \row \i Alt+Up Arrow \i \l home() - \endtable -*/ -void TQTextBrowser::keyPressEvent( TQKeyEvent * e ) -{ - if ( e->state() & AltButton ) { - switch (e->key()) { - case Key_Right: - forward(); - return; - case Key_Left: - backward(); - return; - case Key_Up: - home(); - return; - } - } - TQTextEdit::keyPressEvent(e); -} - -class TQTextDetailPopup : public TQWidget -{ -public: - TQTextDetailPopup() - : TQWidget ( 0, "automatic TQText detail widget", WType_Popup | WDestructiveClose ) - { - } - -protected: - - void mousePressEvent( TQMouseEvent*) - { - close(); - } -}; - - -void TQTextBrowser::popupDetail( const TQString& contents, const TQPoint& pos ) -{ - - const int shadowWidth = 6; // also used as '5' and '6' and even '8' below - const int vMargin = 8; - const int hMargin = 12; - - TQWidget* popup = new TQTextDetailPopup; - popup->setBackgroundMode( TQWidget::NoBackground ); - - TQSimpleRichText* doc = new TQSimpleRichText( contents, popup->font() ); - doc->adjustSize(); - TQRect r( 0, 0, doc->width(), doc->height() ); - - int w = r.width() + 2*hMargin; - int h = r.height() + 2*vMargin; - - popup->resize( w + shadowWidth, h + shadowWidth ); - - // okay, now to find a suitable location - //###### we need a global fancy popup positioning somewhere - popup->move(pos - popup->rect().center()); - if (popup->geometry().right() > TQApplication::desktop()->width()) - popup->move( TQApplication::desktop()->width() - popup->width(), - popup->y() ); - if (popup->geometry().bottom() > TQApplication::desktop()->height()) - popup->move( popup->x(), - TQApplication::desktop()->height() - popup->height() ); - if ( popup->x() < 0 ) - popup->move( 0, popup->y() ); - if ( popup->y() < 0 ) - popup->move( popup->x(), 0 ); - - - popup->show(); - - // now for super-clever shadow stuff. super-clever mostly in - // how many window system problems it skirts around. - - TQPainter p( popup ); - p.setPen( TQApplication::palette().active().foreground() ); - p.drawRect( 0, 0, w, h ); - p.setPen( TQApplication::palette().active().mid() ); - p.setBrush( TQColor( 255, 255, 240 ) ); - p.drawRect( 1, 1, w-2, h-2 ); - p.setPen( black ); - - doc->draw( &p, hMargin, vMargin, r, popup->colorGroup(), 0 ); - delete doc; - - p.drawPoint( w + 5, 6 ); - p.drawLine( w + 3, 6, - w + 5, 8 ); - p.drawLine( w + 1, 6, - w + 5, 10 ); - int i; - for( i=7; i < h; i += 2 ) - p.drawLine( w, i, - w + 5, i + 5 ); - for( i = w - i + h; i > 6; i -= 2 ) - p.drawLine( i, h, - i + 5, h + 5 ); - for( ; i > 0 ; i -= 2 ) - p.drawLine( 6, h + 6 - i, - i + 5, h + 5 ); -} - -/*! - \fn void TQTextBrowser::setText( const TQString &txt ) - - \overload - - Sets the text to \a txt. -*/ - -/*! - \reimp -*/ - -void TQTextBrowser::setText( const TQString &txt, const TQString &context ) -{ - d->textOrSourceChanged = TRUE; - d->curmark = ""; - d->curmain = ""; - TQTextEdit::setText( txt, context ); -} - -void TQTextBrowser::emitHighlighted( const TQString &s ) -{ - emit highlighted( s ); -} - -void TQTextBrowser::emitLinkClicked( const TQString &s ) -{ - d->textOrSourceChanged = FALSE; - emit linkClicked( s ); - if ( !d->textOrSourceChanged ) - setSource( s ); -} - -#endif // TQT_NO_TEXTBROWSER diff --git a/src/widgets/qtextedit.cpp b/src/widgets/qtextedit.cpp deleted file mode 100644 index 0fb328bf..00000000 --- a/src/widgets/qtextedit.cpp +++ /dev/null @@ -1,7474 +0,0 @@ -/**************************************************************************** -** -** Implementation of the TQTextEdit class -** -** Created : 990101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqtextedit.h" - -#ifndef TQT_NO_TEXTEDIT - -// Keep this position to avoid patch rejection -#ifndef TQT_NO_IM -#include "ntqinputcontext.h" -#endif - -#include "../kernel/qrichtext_p.h" -#include "ntqpainter.h" -#include "ntqpen.h" -#include "ntqbrush.h" -#include "ntqpixmap.h" -#include "ntqfont.h" -#include "ntqcolor.h" -#include "ntqstyle.h" -#include "ntqsize.h" -#include "ntqevent.h" -#include "ntqtimer.h" -#include "ntqapplication.h" -#include "ntqlistbox.h" -#include "ntqvbox.h" -#include "ntqapplication.h" -#include "ntqclipboard.h" -#include "ntqcolordialog.h" -#include "ntqfontdialog.h" -#include "ntqstylesheet.h" -#include "ntqdragobject.h" -#include "ntqurl.h" -#include "ntqcursor.h" -#include "ntqregexp.h" -#include "ntqpopupmenu.h" -#include "tqptrstack.h" -#include "ntqmetaobject.h" -#include "ntqtextbrowser.h" -#include <private/qucom_p.h> -#include "private/qsyntaxhighlighter_p.h" -#include <ntqguardedptr.h> - -#ifndef TQT_NO_ACCEL -#include <ntqkeysequence.h> -#define ACCEL_KEY(k) "\t" + TQString(TQKeySequence( TQt::CTRL | TQt::Key_ ## k )) -#else -#define ACCEL_KEY(k) "\t" + TQString("Ctrl+" #k) -#endif - -#ifdef QT_TEXTEDIT_OPTIMIZATION -#define LOGOFFSET(i) d->logOffset + i -#endif - -struct TQUndoRedoInfoPrivate -{ - TQTextString text; -}; - -class TQTextEditPrivate -{ -public: - TQTextEditPrivate() - :preeditStart(-1),preeditLength(-1),ensureCursorVisibleInShowEvent(FALSE), - tabChangesFocus(FALSE), -#ifndef TQT_NO_CLIPBOARD - clipboard_mode( TQClipboard::Clipboard ), -#endif -#ifdef QT_TEXTEDIT_OPTIMIZATION - od(0), optimMode(FALSE), - maxLogLines(-1), - logOffset(0), -#endif - autoFormatting( (uint)TQTextEdit::AutoAll ) - { - for ( int i=0; i<7; i++ ) - id[i] = 0; - } - int id[ 7 ]; - int preeditStart; - int preeditLength; - bool composeMode() const { return ( preeditLength > 0 ); } - - uint ensureCursorVisibleInShowEvent : 1; - uint tabChangesFocus : 1; - TQString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized - TQString pressedName; - TQString onName; -#ifndef TQT_NO_CLIPBOARD - TQClipboard::Mode clipboard_mode; -#endif - TQTimer *trippleClickTimer; - TQPoint trippleClickPoint; -#ifdef QT_TEXTEDIT_OPTIMIZATION - TQTextEditOptimPrivate * od; - bool optimMode : 1; - int maxLogLines; - int logOffset; -#endif - uint autoFormatting; -}; - -#ifndef TQT_NO_MIME -class TQRichTextDrag : public TQTextDrag -{ -public: - TQRichTextDrag( TQWidget *dragSource = 0, const char *name = 0 ); - - void setPlainText( const TQString &txt ) { setText( txt ); } - void setRichText( const TQString &txt ) { richTxt = txt; } - - virtual TQByteArray encodedData( const char *mime ) const; - virtual const char* format( int i ) const; - - static bool decode( TQMimeSource *e, TQString &str, const TQCString &mimetype, - const TQCString &subtype ); - static bool canDecode( TQMimeSource* e ); - -private: - TQString richTxt; - -}; - -TQRichTextDrag::TQRichTextDrag( TQWidget *dragSource, const char *name ) - : TQTextDrag( dragSource, name ) -{ -} - -TQByteArray TQRichTextDrag::encodedData( const char *mime ) const -{ - if ( qstrcmp( "application/x-qrichtext", mime ) == 0 ) { - return richTxt.utf8(); // #### perhaps we should use USC2 instead? - } else - return TQTextDrag::encodedData( mime ); -} - -bool TQRichTextDrag::decode( TQMimeSource *e, TQString &str, const TQCString &mimetype, - const TQCString &subtype ) -{ - if ( mimetype == "application/x-qrichtext" ) { - // do richtext decode - const char *mime; - int i; - for ( i = 0; ( mime = e->format( i ) ); ++i ) { - if ( qstrcmp( "application/x-qrichtext", mime ) != 0 ) - continue; - str = TQString::fromUtf8( e->encodedData( mime ) ); - return TRUE; - } - return FALSE; - } - - // do a regular text decode - TQCString subt = subtype; - return TQTextDrag::decode( e, str, subt ); -} - -bool TQRichTextDrag::canDecode( TQMimeSource* e ) -{ - if ( e->provides( "application/x-qrichtext" ) ) - return TRUE; - return TQTextDrag::canDecode( e ); -} - -const char* TQRichTextDrag::format( int i ) const -{ - if ( TQTextDrag::format( i ) ) - return TQTextDrag::format( i ); - if ( TQTextDrag::format( i-1 ) ) - return "application/x-qrichtext"; - return 0; -} - -#endif - -static bool block_set_alignment = FALSE; - -/*! - \class TQTextEdit ntqtextedit.h - \brief The TQTextEdit widget provides a powerful single-page rich text editor. - - \ingroup basic - \ingroup text - \mainclass - - \tableofcontents - - \section1 Introduction and Concepts - - TQTextEdit is an advanced WYSIWYG viewer/editor supporting rich - text formatting using HTML-style tags. It is optimized to handle - large documents and to respond quickly to user input. - - TQTextEdit has four modes of operation: - \table - \header \i Mode \i Command \i Notes - \row \i Plain Text Editor \i setTextFormat(PlainText) - \i Set text with setText(); text() returns plain text. Text - attributes (e.g. colors) can be set, but plain text is always - returned. - \row \i Rich Text Editor \i setTextFormat(RichText) - \i Set text with setText(); text() returns rich text. Rich - text editing is fairly limited. You can't set margins or - insert images for example (although you can read and - correctly display files that have margins set and that - include images). This mode is mostly useful for editing small - amounts of rich text. <sup>1.</sup> - \row \i Text Viewer \i setReadOnly(TRUE) - \i Set text with setText() or append() (which has no undo - history so is faster and uses less memory); text() returns - plain or rich text depending on the textFormat(). This mode - can correctly display a large subset of HTML tags. - \row \i Log Viewer \i setTextFormat(LogText) - \i Append text using append(). The widget is set to be read - only and rich text support is disabled although a few HTML - tags (for color, bold, italic and underline) may be used. - (See \link #logtextmode LogText mode\endlink for details.) - \endtable - - <sup>1.</sup><small>A more complete API that supports setting - margins, images, etc., is planned for a later TQt release.</small> - - TQTextEdit can be used as a syntax highlighting editor when used in - conjunction with TQSyntaxHighlighter. - - We recommend that you always call setTextFormat() to set the mode - you want to use. If you use \c AutoText then setText() and - append() will try to determine whether the text they are given is - plain text or rich text. If you use \c RichText then setText() and - append() will assume that the text they are given is rich text. - insert() simply inserts the text it is given. - - TQTextEdit works on paragraphs and characters. A paragraph is a - formatted string which is word-wrapped to fit into the width of - the widget. By default when reading plain text, one newline - signify a paragraph. A document consists of zero or more - paragraphs, indexed from 0. Characters are indexed on a - per-paragraph basis, also indexed from 0. The words in the - paragraph are aligned in accordance with the paragraph's - alignment(). Paragraphs are separated by hard line breaks. Each - character within a paragraph has its own attributes, for example, - font and color. - - The text edit documentation uses the following concepts: - \list - \i \e{current format} -- - this is the format at the current cursor position, \e and it - is the format of the selected text if any. - \i \e{current paragraph} -- the paragraph which contains the - cursor. - \endlist - - TQTextEdit can display images (using TQMimeSourceFactory), lists and - tables. If the text is too large to view within the text edit's - viewport, scrollbars will appear. The text edit can load both - plain text and HTML files (a subset of HTML 3.2 and 4). The - rendering style and the set of valid tags are defined by a - styleSheet(). Custom tags can be created and placed in a custom - style sheet. Change the style sheet with \l{setStyleSheet()}; see - TQStyleSheet for details. The images identified by image tags are - displayed if they can be interpreted using the text edit's - \l{TQMimeSourceFactory}; see setMimeSourceFactory(). - - If you want a text browser with more navigation use TQTextBrowser. - If you just need to display a small piece of rich text use TQLabel - or TQSimpleRichText. - - If you create a new TQTextEdit, and want to allow the user to edit - rich text, call setTextFormat(TQt::RichText) to ensure that the - text is treated as rich text. (Rich text uses HTML tags to set - text formatting attributes. See TQStyleSheet for information on the - HTML tags that are supported.). If you don't call setTextFormat() - explicitly the text edit will guess from the text itself whether - it is rich text or plain text. This means that if the text looks - like HTML or XML it will probably be interpreted as rich text, so - you should call setTextFormat(TQt::PlainText) to preserve such - text. - - Note that we do not intend to add a full-featured web browser - widget to TQt (because that would easily double TQt's size and only - a few applications would benefit from it). The rich - text support in TQt is designed to provide a fast, portable and - efficient way to add reasonable online help facilities to - applications, and to provide a basis for rich text editors. - - \section1 Using TQTextEdit as a Display Widget - - TQTextEdit can display a large HTML subset, including tables and - images. - - The text is set or replaced using setText() which deletes any - existing text and replaces it with the text passed in the - setText() call. If you call setText() with legacy HTML (with - setTextFormat(RichText) in force), and then call text(), the text - that is returned may have different markup, but will render the - same. Text can be inserted with insert(), paste(), pasteSubType() - and append(). Text that is appended does not go into the undo - history; this makes append() faster and consumes less memory. Text - can also be cut(). The entire text is deleted with clear() and the - selected text is deleted with removeSelectedText(). Selected - (marked) text can also be deleted with del() (which will delete - the character to the right of the cursor if no text is selected). - - Loading and saving text is achieved using setText() and text(), - for example: - \code - TQFile file( fileName ); // Read the text from a file - if ( file.open( IO_ReadOnly ) ) { - TQTextStream stream( &file ); - textEdit->setText( stream.read() ); - } - - TQFile file( fileName ); // Write the text to a file - if ( file.open( IO_WriteOnly ) ) { - TQTextStream stream( &file ); - stream << textEdit->text(); - textEdit->setModified( FALSE ); - } - \endcode - - By default the text edit wraps words at whitespace to fit within - the text edit widget. The setWordWrap() function is used to - specify the kind of word wrap you want, or \c NoWrap if you don't - want any wrapping. Call setWordWrap() to set a fixed pixel width - \c FixedPixelWidth, or character column (e.g. 80 column) \c - FixedColumnWidth with the pixels or columns specified with - setWrapColumnOrWidth(). If you use word wrap to the widget's width - \c WidgetWidth, you can specify whether to break on whitespace or - anywhere with setWrapPolicy(). - - The background color is set differently than other widgets, using - setPaper(). You specify a brush style which could be a plain color - or a complex pixmap. - - Hypertext links are automatically underlined; this can be changed - with setLinkUnderline(). The tab stop width is set with - setTabStopWidth(). - - The zoomIn() and zoomOut() functions can be used to resize the - text by increasing (decreasing for zoomOut()) the point size used. - Images are not affected by the zoom functions. - - The lines() function returns the number of lines in the text and - paragraphs() returns the number of paragraphs. The number of lines - within a particular paragraph is returned by linesOfParagraph(). - The length of the entire text in characters is returned by - length(). - - You can scroll to an anchor in the text, e.g. - \c{<a name="anchor">} with scrollToAnchor(). The find() function - can be used to find and select a given string within the text. - - A read-only TQTextEdit provides the same functionality as the - (obsolete) TQTextView. (TQTextView is still supplied for - compatibility with old code.) - - \section2 Read-only key bindings - - When TQTextEdit is used read-only the key-bindings are limited to - navigation, and text may only be selected with the mouse: - \table - \header \i Keypresses \i Action - \row \i UpArrow \i Move one line up - \row \i DownArrow \i Move one line down - \row \i LeftArrow \i Move one character left - \row \i RightArrow \i Move one character right - \row \i PageUp \i Move one (viewport) page up - \row \i PageDown \i Move one (viewport) page down - \row \i Home \i Move to the beginning of the text - \row \i End \i Move to the end of the text - \row \i Shift+Wheel - \i Scroll the page horizontally (the Wheel is the mouse wheel) - \row \i Ctrl+Wheel \i Zoom the text - \endtable - - The text edit may be able to provide some meta-information. For - example, the documentTitle() function will return the text from - within HTML \c{<title>} tags. - - The text displayed in a text edit has a \e context. The context is - a path which the text edit's TQMimeSourceFactory uses to resolve - the locations of files and images. It is passed to the - mimeSourceFactory() when quering data. (See TQTextEdit() and - \l{context()}.) - - \target logtextmode - \section2 Using TQTextEdit in LogText Mode - - Setting the text format to \c LogText puts the widget in a special - mode which is optimized for very large texts. Editing, word wrap, - and rich text support are disabled in this mode (the widget is - explicitly made read-only). This allows the text to be stored in a - different, more memory efficient manner. However, a certain degree - of text formatting is supported through the use of formatting tags. - A tag is delimited by \c < and \c {>}. The characters \c {<}, \c > - and \c & are escaped by using \c {<}, \c {>} and \c {&}. - A tag pair consists of a left and a right tag (or open/close tags). - Left-tags mark the starting point for formatting, while right-tags - mark the ending point. A right-tag always start with a \c / before - the tag keyword. For example \c <b> and \c </b> are a tag pair. - Tags can be nested, but they have to be closed in the same order as - they are opened. For example, \c <b><u></u></b> is valid, while \c - <b><u></b></u> will output an error message. - - By using tags it is possible to change the color, bold, italic and - underline settings for a piece of text. A color can be specified - by using the HTML font tag \c {<font color=colorname>}. The color - name can be one of the color names from the X11 color database, or - a RGB hex value (e.g \c {#00ff00}). Example of valid color tags: - \c {<font color=red>}, \c {<font color="light blue">}, \c {<font - color="#223344">}. Bold, italic and underline settings can be - specified by the tags \c {<b>}, \c <i> and \c {<u>}. Note that a - tag does not necessarily have to be closed. A valid example: - \code - This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>. - <font color=green><font color=yellow>Yellow,</font> and <u>green</u>. - \endcode - - Stylesheets can also be used in LogText mode. To create and use a - custom tag, you could do the following: - \code - TQTextEdit * log = new TQTextEdit( this ); - log->setTextFormat( TQt::LogText ); - TQStyleSheetItem * item = new TQStyleSheetItem( log->styleSheet(), "mytag" ); - item->setColor( "red" ); - item->setFontWeight( TQFont::Bold ); - item->setFontUnderline( TRUE ); - log->append( "This is a <mytag>custom tag</mytag>!" ); - \endcode - Note that only the color, bold, underline and italic attributes of - a TQStyleSheetItem is used in LogText mode. - - Note that you can use setMaxLogLines() to limit the number of - lines the widget can hold in LogText mode. - - There are a few things that you need to be aware of when the - widget is in this mode: - \list - \i Functions that deal with rich text formatting and cursor - movement will not work or return anything valid. - \i Lines are equivalent to paragraphs. - \endlist - - \section1 Using TQTextEdit as an Editor - - All the information about using TQTextEdit as a display widget also - applies here. - - The current format's attributes are set with setItalic(), - setBold(), setUnderline(), setFamily() (font family), - setPointSize(), setColor() and setCurrentFont(). The current - paragraph's alignment is set with setAlignment(). - - Use setSelection() to select text. The setSelectionAttributes() - function is used to indicate how selected text should be - displayed. Use hasSelectedText() to find out if any text is - selected. The currently selected text's position is available - using getSelection() and the selected text itself is returned by - selectedText(). The selection can be copied to the clipboard with - copy(), or cut to the clipboard with cut(). It can be deleted with - removeSelectedText(). The entire text can be selected (or - unselected) using selectAll(). TQTextEdit supports multiple - selections. Most of the selection functions operate on the default - selection, selection 0. If the user presses a non-selecting key, - e.g. a cursor key without also holding down Shift, all selections - are cleared. - - Set and get the position of the cursor with setCursorPosition() - and getCursorPosition() respectively. When the cursor is moved, - the signals currentFontChanged(), currentColorChanged() and - currentAlignmentChanged() are emitted to reflect the font, color - and alignment at the new cursor position. - - If the text changes, the textChanged() signal is emitted, and if - the user inserts a new line by pressing Return or Enter, - returnPressed() is emitted. The isModified() function will return - TRUE if the text has been modified. - - TQTextEdit provides command-based undo and redo. To set the depth - of the command history use setUndoDepth() which defaults to 100 - steps. To undo or redo the last operation call undo() or redo(). - The signals undoAvailable() and redoAvailable() indicate whether - the undo and redo operations can be executed. - - The indent() function is used to reindent a paragraph. It is - useful for code editors, for example in \link designer-manual.book - TQt Designer\endlink's code editor \e{Ctrl+I} invokes the indent() - function. - - \section2 Editing key bindings - - The list of key-bindings which are implemented for editing: - \table - \header \i Keypresses \i Action - \row \i Backspace \i Delete the character to the left of the cursor - \row \i Delete \i Delete the character to the right of the cursor - \row \i Ctrl+A \i Move the cursor to the beginning of the line - \row \i Ctrl+B \i Move the cursor one character left - \row \i Ctrl+C \i Copy the marked text to the clipboard (also - Ctrl+Insert under Windows) - \row \i Ctrl+D \i Delete the character to the right of the cursor - \row \i Ctrl+E \i Move the cursor to the end of the line - \row \i Ctrl+F \i Move the cursor one character right - \row \i Ctrl+H \i Delete the character to the left of the cursor - \row \i Ctrl+K \i Delete to end of line - \row \i Ctrl+N \i Move the cursor one line down - \row \i Ctrl+P \i Move the cursor one line up - \row \i Ctrl+V \i Paste the clipboard text into line edit - (also Shift+Insert under Windows) - \row \i Ctrl+X \i Cut the marked text, copy to clipboard - (also Shift+Delete under Windows) - \row \i Ctrl+Z \i Undo the last operation - \row \i Ctrl+Y \i Redo the last operation - \row \i LeftArrow \i Move the cursor one character left - \row \i Ctrl+LeftArrow \i Move the cursor one word left - \row \i RightArrow \i Move the cursor one character right - \row \i Ctrl+RightArrow \i Move the cursor one word right - \row \i UpArrow \i Move the cursor one line up - \row \i Ctrl+UpArrow \i Move the cursor one word up - \row \i DownArrow \i Move the cursor one line down - \row \i Ctrl+Down Arrow \i Move the cursor one word down - \row \i PageUp \i Move the cursor one page up - \row \i PageDown \i Move the cursor one page down - \row \i Home \i Move the cursor to the beginning of the line - \row \i Ctrl+Home \i Move the cursor to the beginning of the text - \row \i End \i Move the cursor to the end of the line - \row \i Ctrl+End \i Move the cursor to the end of the text - \row \i Shift+Wheel \i Scroll the page horizontally - (the Wheel is the mouse wheel) - \row \i Ctrl+Wheel \i Zoom the text - \endtable - - To select (mark) text hold down the Shift key whilst pressing one - of the movement keystrokes, for example, \e{Shift+Right Arrow} - will select the character to the right, and \e{Shift+Ctrl+Right - Arrow} will select the word to the right, etc. - - By default the text edit widget operates in insert mode so all - text that the user enters is inserted into the text edit and any - text to the right of the cursor is moved out of the way. The mode - can be changed to overwrite, where new text overwrites any text to - the right of the cursor, using setOverwriteMode(). -*/ - -/*! - \enum TQTextEdit::AutoFormatting - - \value AutoNone Do not perform any automatic formatting - \value AutoBulletList Only automatically format bulletted lists - \value AutoAll Apply all available autoformatting -*/ - - -/*! - \enum TQTextEdit::KeyboardAction - - This enum is used by doKeyboardAction() to specify which action - should be executed: - - \value ActionBackspace Delete the character to the left of the - cursor. - - \value ActionDelete Delete the character to the right of the - cursor. - - \value ActionReturn Split the paragraph at the cursor position. - - \value ActionKill If the cursor is not at the end of the - paragraph, delete the text from the cursor position until the end - of the paragraph. If the cursor is at the end of the paragraph, - delete the hard line break at the end of the paragraph: this will - cause this paragraph to be joined with the following paragraph. - - \value ActionWordBackspace Delete the word to the left of the - cursor position. - - \value ActionWordDelete Delete the word to the right of the - cursor position - -*/ - -/*! - \enum TQTextEdit::VerticalAlignment - - This enum is used to set the vertical alignment of the text. - - \value AlignNormal Normal alignment - \value AlignSuperScript Superscript - \value AlignSubScript Subscript -*/ - -/*! - \enum TQTextEdit::TextInsertionFlags - - \internal - - \value RedoIndentation - \value CheckNewLines - \value RemoveSelected -*/ - - -/*! - \fn void TQTextEdit::copyAvailable(bool yes) - - This signal is emitted when text is selected or de-selected in the - text edit. - - When text is selected this signal will be emitted with \a yes set - to TRUE. If no text has been selected or if the selected text is - de-selected this signal is emitted with \a yes set to FALSE. - - If \a yes is TRUE then copy() can be used to copy the selection to - the clipboard. If \a yes is FALSE then copy() does nothing. - - \sa selectionChanged() -*/ - - -/*! - \fn void TQTextEdit::textChanged() - - This signal is emitted whenever the text in the text edit changes. - - \sa setText() append() -*/ - -/*! - \fn void TQTextEdit::selectionChanged() - - This signal is emitted whenever the selection changes. - - \sa setSelection() copyAvailable() -*/ - -/*! \fn TQTextDocument *TQTextEdit::document() const - - \internal - - This function returns the TQTextDocument which is used by the text - edit. -*/ - -/*! \fn void TQTextEdit::setDocument( TQTextDocument *doc ) - - \internal - - This function sets the TQTextDocument which should be used by the text - edit to \a doc. This can be used, for example, if you want to - display a document using multiple views. You would create a - TQTextDocument and set it to the text edits which should display it. - You would need to connect to the textChanged() and - selectionChanged() signals of all the text edits and update them all - accordingly (preferably with a slight delay for efficiency reasons). -*/ - -/*! - \enum TQTextEdit::CursorAction - - This enum is used by moveCursor() to specify in which direction - the cursor should be moved: - - \value MoveBackward Moves the cursor one character backward - - \value MoveWordBackward Moves the cursor one word backward - - \value MoveForward Moves the cursor one character forward - - \value MoveWordForward Moves the cursor one word forward - - \value MoveUp Moves the cursor up one line - - \value MoveDown Moves the cursor down one line - - \value MoveLineStart Moves the cursor to the beginning of the line - - \value MoveLineEnd Moves the cursor to the end of the line - - \value MoveHome Moves the cursor to the beginning of the document - - \value MoveEnd Moves the cursor to the end of the document - - \value MovePgUp Moves the cursor one viewport page up - - \value MovePgDown Moves the cursor one viewport page down -*/ - -/*! - \enum TQt::AnchorAttribute - - An anchor has one or more of the following attributes: - - \value AnchorName the name attribute of the anchor. This attribute is - used when scrolling to an anchor in the document. - - \value AnchorHref the href attribute of the anchor. This attribute is - used when a link is clicked to determine what content to load. -*/ - -/*! - \property TQTextEdit::overwriteMode - \brief the text edit's overwrite mode - - If FALSE (the default) characters entered by the user are inserted - with any characters to the right being moved out of the way. If - TRUE, the editor is in overwrite mode, i.e. characters entered by - the user overwrite any characters to the right of the cursor - position. -*/ - -/*! - \fn void TQTextEdit::setCurrentFont( const TQFont &f ) - - Sets the font of the current format to \a f. - - If the widget is in \c LogText mode this function will do - nothing. Use setFont() instead. - - \sa currentFont() setPointSize() setFamily() -*/ - -/*! - \property TQTextEdit::undoDepth - \brief the depth of the undo history - - The maximum number of steps in the undo/redo history. The default - is 100. - - \sa undo() redo() -*/ - -/*! - \fn void TQTextEdit::undoAvailable( bool yes ) - - This signal is emitted when the availability of undo changes. If - \a yes is TRUE, then undo() will work until undoAvailable( FALSE ) - is next emitted. - - \sa undo() undoDepth() -*/ - -/*! - \fn void TQTextEdit::modificationChanged( bool m ) - - This signal is emitted when the modification status of the - document has changed. If \a m is TRUE, the document was modified, - otherwise the modification state has been reset to unmodified. - - \sa modified -*/ - -/*! - \fn void TQTextEdit::redoAvailable( bool yes ) - - This signal is emitted when the availability of redo changes. If - \a yes is TRUE, then redo() will work until redoAvailable( FALSE ) - is next emitted. - - \sa redo() undoDepth() -*/ - -/*! - \fn void TQTextEdit::currentFontChanged( const TQFont &f ) - - This signal is emitted if the font of the current format has - changed. - - The new font is \a f. - - \sa setCurrentFont() -*/ - -/*! - \fn void TQTextEdit::currentColorChanged( const TQColor &c ) - - This signal is emitted if the color of the current format has - changed. - - The new color is \a c. - - \sa setColor() -*/ - -/*! - \fn void TQTextEdit::currentVerticalAlignmentChanged( VerticalAlignment a ) - - This signal is emitted if the vertical alignment of the current - format has changed. - - The new vertical alignment is \a a. - - \sa setVerticalAlignment() -*/ - -/*! - \fn void TQTextEdit::currentAlignmentChanged( int a ) - - This signal is emitted if the alignment of the current paragraph - has changed. - - The new alignment is \a a. - - \sa setAlignment() -*/ - -/*! - \fn void TQTextEdit::cursorPositionChanged( TQTextCursor *c ) - - \internal -*/ - -/*! - \fn void TQTextEdit::cursorPositionChanged( int para, int pos ) - - This signal is emitted if the position of the cursor has changed. - \a para contains the paragraph index and \a pos contains the - character position within the paragraph. - - \sa setCursorPosition() -*/ - -/*! - \fn void TQTextEdit::clicked( int para, int pos ) - - This signal is emitted when the mouse is clicked on the paragraph - \a para at character position \a pos. - - \sa doubleClicked() -*/ - -/*! \fn void TQTextEdit::doubleClicked( int para, int pos ) - - This signal is emitted when the mouse is double-clicked on the - paragraph \a para at character position \a pos. - - \sa clicked() -*/ - - -/*! - \fn void TQTextEdit::returnPressed() - - This signal is emitted if the user pressed the Return or the Enter - key. -*/ - -/*! - \fn TQTextCursor *TQTextEdit::textCursor() const - - Returns the text edit's text cursor. - - \warning TQTextCursor is not in the public API, but in special - circumstances you might wish to use it. -*/ - -/*! - Constructs an empty TQTextEdit called \a name, with parent \a - parent. -*/ - -TQTextEdit::TQTextEdit( TQWidget *parent, const char *name ) - : TQScrollView( parent, name, WStaticContents | WNoAutoErase ), - doc( new TQTextDocument( 0 ) ), undoRedoInfo( doc ) -{ - init(); -} - -/*! - Constructs a TQTextEdit called \a name, with parent \a parent. The - text edit will display the text \a text using context \a context. - - The \a context is a path which the text edit's TQMimeSourceFactory - uses to resolve the locations of files and images. It is passed to - the mimeSourceFactory() when quering data. - - For example if the text contains an image tag, - \c{<img src="image.png">}, and the context is "path/to/look/in", the - TQMimeSourceFactory will try to load the image from - "path/to/look/in/image.png". If the tag was - \c{<img src="/image.png">}, the context will not be used (because - TQMimeSourceFactory recognizes that we have used an absolute path) - and will try to load "/image.png". The context is applied in exactly - the same way to \e hrefs, for example, - \c{<a href="target.html">Target</a>}, would resolve to - "path/to/look/in/target.html". -*/ - -TQTextEdit::TQTextEdit( const TQString& text, const TQString& context, - TQWidget *parent, const char *name) - : TQScrollView( parent, name, WStaticContents | WNoAutoErase ), - doc( new TQTextDocument( 0 ) ), undoRedoInfo( doc ) -{ - init(); - setText( text, context ); -} - -/*! - \reimp -*/ - -TQTextEdit::~TQTextEdit() -{ - delete undoRedoInfo.d; - undoRedoInfo.d = 0; - delete cursor; - delete doc; -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - delete d->od; -#endif - delete d; -} - -void TQTextEdit::init() -{ - d = new TQTextEditPrivate; - doc->formatCollection()->setPaintDevice( this ); - undoEnabled = TRUE; - readOnly = TRUE; - setReadOnly( FALSE ); - setFrameStyle( LineEditPanel | Sunken ); - connect( doc, TQ_SIGNAL( minimumWidthChanged(int) ), - this, TQ_SLOT( documentWidthChanged(int) ) ); - - mousePressed = FALSE; - inDoubleClick = FALSE; - modified = FALSE; - onLink = TQString::null; - d->onName = TQString::null; - overWrite = FALSE; - wrapMode = WidgetWidth; - wrapWidth = -1; - wPolicy = AtWhiteSpace; - mightStartDrag = FALSE; - inDnD = FALSE; - doc->setFormatter( new TQTextFormatterBreakWords ); - doc->formatCollection()->defaultFormat()->setFont( TQScrollView::font() ); - doc->formatCollection()->defaultFormat()->setColor( colorGroup().color( TQColorGroup::Text ) ); - currentFormat = doc->formatCollection()->defaultFormat(); - currentAlignment = TQt::AlignAuto; - - setBackgroundMode( PaletteBase ); - viewport()->setBackgroundMode( PaletteBase ); - viewport()->setAcceptDrops( TRUE ); - resizeContents( 0, doc->lastParagraph() ? - ( doc->lastParagraph()->paragId() + 1 ) * doc->formatCollection()->defaultFormat()->height() : 0 ); - - setKeyCompression( TRUE ); - viewport()->setMouseTracking( TRUE ); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - cursor = new TQTextCursor( doc ); - - formatTimer = new TQTimer( this ); - connect( formatTimer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( formatMore() ) ); - lastFormatted = doc->firstParagraph(); - - scrollTimer = new TQTimer( this ); - connect( scrollTimer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( autoScrollTimerDone() ) ); - - interval = 0; - changeIntervalTimer = new TQTimer( this ); - connect( changeIntervalTimer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( doChangeInterval() ) ); - - cursorVisible = TRUE; - blinkTimer = new TQTimer( this ); - connect( blinkTimer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( blinkCursor() ) ); - -#ifndef TQT_NO_DRAGANDDROP - dragStartTimer = new TQTimer( this ); - connect( dragStartTimer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( startDrag() ) ); -#endif - - d->trippleClickTimer = new TQTimer( this ); - - formatMore(); - - blinkCursorVisible = FALSE; - - viewport()->setFocusProxy( this ); - viewport()->setFocusPolicy( WheelFocus ); - setInputMethodEnabled( TRUE ); - viewport()->installEventFilter( this ); - connect( this, TQ_SIGNAL(horizontalSliderReleased()), this, TQ_SLOT(sliderReleased()) ); - connect( this, TQ_SIGNAL(verticalSliderReleased()), this, TQ_SLOT(sliderReleased()) ); - installEventFilter( this ); -} - -void TQTextEdit::paintDocument( bool drawAll, TQPainter *p, int cx, int cy, int cw, int ch ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - Q_ASSERT( !d->optimMode ); - if ( d->optimMode ) - return; -#endif - - bool drawCur = hasFocus() || viewport()->hasFocus(); - if (( hasSelectedText() && !style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) || - isReadOnly() || !cursorVisible || doc->hasSelection( TQTextDocument::IMSelectionText )) - drawCur = FALSE; - TQColorGroup g = colorGroup(); - const TQColorGroup::ColorRole backRole = TQPalette::backgroundRoleFromMode(backgroundMode()); - if ( doc->paper() ) - g.setBrush( backRole, *doc->paper() ); - - if ( contentsY() < doc->y() ) { - p->fillRect( contentsX(), contentsY(), visibleWidth(), doc->y(), - g.brush( backRole ) ); - } - if ( drawAll && doc->width() - contentsX() < cx + cw ) { - p->fillRect( doc->width() - contentsX(), cy, cx + cw - doc->width() + contentsX(), ch, - g.brush( backRole ) ); - } - - p->setBrushOrigin( -contentsX(), -contentsY() ); - - lastFormatted = doc->draw( p, cx, cy, cw, ch, g, !drawAll, drawCur, cursor ); - - if ( lastFormatted == doc->lastParagraph() ) - resizeContents( contentsWidth(), doc->height() ); - - if ( contentsHeight() < visibleHeight() && ( !doc->lastParagraph() || doc->lastParagraph()->isValid() ) && drawAll ) - p->fillRect( 0, contentsHeight(), visibleWidth(), - visibleHeight() - contentsHeight(), g.brush( backRole ) ); -} - -/*! - \reimp -*/ - -void TQTextEdit::drawContents( TQPainter *p, int cx, int cy, int cw, int ch ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimDrawContents( p, cx, cy, cw, ch ); - return; - } -#endif - paintDocument( TRUE, p, cx, cy, cw, ch ); - int v; - p->setPen( foregroundColor() ); - if ( document()->isPageBreakEnabled() && ( v = document()->flow()->pageSize() ) > 0 ) { - int l = int(cy / v) * v; - while ( l < cy + ch ) { - p->drawLine( cx, l, cx + cw - 1, l ); - l += v; - } - } - - // This invocation is required to follow dragging of active window - // by the showed candidate window. - updateMicroFocusHint(); -} - -/*! - \reimp -*/ - -void TQTextEdit::drawContents( TQPainter *p ) -{ - if ( horizontalScrollBar()->isVisible() && - verticalScrollBar()->isVisible() ) { - const TQRect verticalRect = verticalScrollBar()->geometry(); - const TQRect horizontalRect = horizontalScrollBar()->geometry(); - - TQRect cornerRect; - cornerRect.setTop( verticalRect.bottom() ); - cornerRect.setBottom( horizontalRect.bottom() ); - cornerRect.setLeft( verticalRect.left() ); - cornerRect.setRight( verticalRect.right() ); - - p->fillRect( cornerRect, colorGroup().background() ); - } -} - -/*! - \reimp -*/ - -bool TQTextEdit::event( TQEvent *e ) -{ - if ( e->type() == TQEvent::AccelOverride && !isReadOnly() ) { - TQKeyEvent* ke = (TQKeyEvent*) e; - switch((int)(ke->state())) { - case NoButton: - case Keypad: - case ShiftButton: - if ( ke->key() < Key_Escape ) { - ke->accept(); - } else { - switch ( ke->key() ) { - case Key_Return: - case Key_Enter: - case Key_Delete: - case Key_Home: - case Key_End: - case Key_Backspace: - case Key_Left: - case Key_Right: - ke->accept(); - default: - break; - } - } - break; - - case ControlButton: - case ControlButton|ShiftButton: - case ControlButton|Keypad: - case ControlButton|ShiftButton|Keypad: - switch ( ke->key() ) { - case Key_Tab: - case Key_Backtab: - ke->ignore(); - break; -// Those are too frequently used for application functionality -/* case Key_A: - case Key_B: - case Key_D: - case Key_E: - case Key_F: - case Key_H: - case Key_I: - case Key_K: - case Key_N: - case Key_P: - case Key_T: -*/ - case Key_C: - case Key_V: - case Key_X: - case Key_Y: - case Key_Z: - case Key_Left: - case Key_Right: - case Key_Up: - case Key_Down: - case Key_Home: - case Key_End: -#if defined (TQ_WS_WIN) - case Key_Insert: - case Key_Delete: -#endif - ke->accept(); - default: - break; - } - break; - - default: - switch ( ke->key() ) { -#if defined (TQ_WS_WIN) - case Key_Insert: - ke->accept(); -#endif - default: - break; - } - break; - } - } - - if ( e->type() == TQEvent::Show ) { - if ( -#ifdef QT_TEXTEDIT_OPTIMIZATION - !d->optimMode && -#endif - d->ensureCursorVisibleInShowEvent ) { - ensureCursorVisible(); - d->ensureCursorVisibleInShowEvent = FALSE; - } - if ( !d->scrollToAnchor.isEmpty() ) { - scrollToAnchor( d->scrollToAnchor ); - d->scrollToAnchor = TQString::null; - } - } - return TQWidget::event( e ); -} - -/*! - Processes the key event, \a e. By default key events are used to - provide keyboard navigation and text editing. -*/ - -void TQTextEdit::keyPressEvent( TQKeyEvent *e ) -{ - changeIntervalTimer->stop(); - interval = 10; - bool unknownKey = FALSE; - if ( isReadOnly() ) { - if ( !handleReadOnlyKeyEvent( e ) ) - TQScrollView::keyPressEvent( e ); - changeIntervalTimer->start( 100, TRUE ); - return; - } - - - bool selChanged = FALSE; - for ( int i = 1; i < doc->numSelections(); ++i ) // start with 1 as we don't want to remove the Standard-Selection - selChanged = doc->removeSelection( i ) || selChanged; - - if ( selChanged ) { - cursor->paragraph()->document()->nextDoubleBuffered = TRUE; - repaintChanged(); - } - - bool clearUndoRedoInfo = TRUE; - - - switch ( e->key() ) { - case Key_Left: - case Key_Right: { - // a bit hacky, but can't change this without introducing new enum values for move and keeping the - // correct semantics and movement for BiDi and non BiDi text. - CursorAction a; - if ( cursor->paragraph()->string()->isRightToLeft() == (e->key() == Key_Right) ) - a = e->state() & ControlButton ? MoveWordBackward : MoveBackward; - else - a = e->state() & ControlButton ? MoveWordForward : MoveForward; - moveCursor( a, e->state() & ShiftButton ); - break; - } - case Key_Up: - moveCursor( e->state() & ControlButton ? MovePgUp : MoveUp, e->state() & ShiftButton ); - break; - case Key_Down: - moveCursor( e->state() & ControlButton ? MovePgDown : MoveDown, e->state() & ShiftButton ); - break; - case Key_Home: - moveCursor( e->state() & ControlButton ? MoveHome : MoveLineStart, e->state() & ShiftButton ); - break; - case Key_End: - moveCursor( e->state() & ControlButton ? MoveEnd : MoveLineEnd, e->state() & ShiftButton ); - break; - case Key_Prior: - moveCursor( MovePgUp, e->state() & ShiftButton ); - break; - case Key_Next: - moveCursor( MovePgDown, e->state() & ShiftButton ); - break; - case Key_Return: case Key_Enter: - if ( doc->hasSelection( TQTextDocument::Standard, FALSE ) ) - removeSelectedText(); - if ( textFormat() == TQt::RichText && ( e->state() & ControlButton ) ) { - // Ctrl-Enter inserts a line break in rich text mode - insert( TQString( TQChar( 0x2028) ), TRUE, FALSE ); - } else { -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - clearUndoRedoInfo = FALSE; - doKeyboardAction( ActionReturn ); - emit returnPressed(); - } - break; - case Key_Delete: -#if defined (TQ_WS_WIN) - if ( e->state() & ShiftButton ) { - cut(); - break; - } else -#endif - if ( doc->hasSelection( TQTextDocument::Standard, TRUE ) ) { - removeSelectedText(); - break; - } - doKeyboardAction( e->state() & ControlButton ? ActionWordDelete - : ActionDelete ); - clearUndoRedoInfo = FALSE; - - break; - case Key_Insert: - if ( e->state() & ShiftButton ) - paste(); -#if defined (TQ_WS_WIN) - else if ( e->state() & ControlButton ) - copy(); -#endif - else - setOverwriteMode( !isOverwriteMode() ); - break; - case Key_Backspace: -#if defined (TQ_WS_WIN) - if ( e->state() & AltButton ) { - if (e->state() & ControlButton ) { - break; - } else if ( e->state() & ShiftButton ) { - redo(); - break; - } else { - undo(); - break; - } - } else -#endif - if ( doc->hasSelection( TQTextDocument::Standard, TRUE ) ) { - removeSelectedText(); - break; - } - - doKeyboardAction( e->state() & ControlButton ? ActionWordBackspace - : ActionBackspace ); - clearUndoRedoInfo = FALSE; - break; - case Key_F16: // Copy key on Sun keyboards - copy(); - break; - case Key_F18: // Paste key on Sun keyboards - paste(); - break; - case Key_F20: // Cut key on Sun keyboards - cut(); - break; - case Key_Direction_L: - if ( doc->textFormat() == TQt::PlainText ) { - // change the whole doc - TQTextParagraph *p = doc->firstParagraph(); - while ( p ) { - p->setDirection( TQChar::DirL ); - p->setAlignment( TQt::AlignLeft ); - p->invalidate( 0 ); - p = p->next(); - } - } else { - if ( !cursor->paragraph() || cursor->paragraph()->direction() == TQChar::DirL ) - return; - cursor->paragraph()->setDirection( TQChar::DirL ); - if ( cursor->paragraph()->length() <= 1&& - ( (cursor->paragraph()->alignment() & (TQt::AlignLeft | TQt::AlignRight) ) != 0 ) ) - setAlignment( TQt::AlignLeft ); - } - repaintChanged(); - break; - case Key_Direction_R: - if ( doc->textFormat() == TQt::PlainText ) { - // change the whole doc - TQTextParagraph *p = doc->firstParagraph(); - while ( p ) { - p->setDirection( TQChar::DirR ); - p->setAlignment( TQt::AlignRight ); - p->invalidate( 0 ); - p = p->next(); - } - } else { - if ( !cursor->paragraph() || cursor->paragraph()->direction() == TQChar::DirR ) - return; - cursor->paragraph()->setDirection( TQChar::DirR ); - if ( cursor->paragraph()->length() <= 1&& - ( (cursor->paragraph()->alignment() & (TQt::AlignLeft | TQt::AlignRight) ) != 0 ) ) - setAlignment( TQt::AlignRight ); - } - repaintChanged(); - break; - default: { - if ( e->text().length() && - ( ( !( e->state() & ControlButton ) && -#ifndef Q_OS_MACX - !( e->state() & AltButton ) && -#endif - !( e->state() & MetaButton ) ) || - ( ( (e->state()&ControlButton) | AltButton ) == (ControlButton|AltButton) ) ) && - ( !e->ascii() || e->ascii() >= 32 || e->text() == "\t" ) ) { - clearUndoRedoInfo = FALSE; - if ( e->key() == Key_Tab ) { - if ( d->tabChangesFocus ) { - e->ignore(); - break; - } - if ( textFormat() == TQt::RichText && cursor->index() == 0 - && ( cursor->paragraph()->isListItem() || cursor->paragraph()->listDepth() ) ) { - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Style; - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.eid = undoRedoInfo.id; - undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); - cursor->paragraph()->setListDepth( cursor->paragraph()->listDepth() +1 ); - clearUndoRedo(); - drawCursor( FALSE ); - repaintChanged(); - drawCursor( TRUE ); - break; - } - } else if ( e->key() == Key_BackTab ) { - if ( d->tabChangesFocus ) { - e->ignore(); - break; - } - } - - if ( ( autoFormatting() & AutoBulletList ) && - textFormat() == TQt::RichText && cursor->index() == 0 - && !cursor->paragraph()->isListItem() - && ( e->text()[0] == '-' || e->text()[0] == '*' ) ) { - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Style; - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.eid = undoRedoInfo.id; - undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); - setParagType( TQStyleSheetItem::DisplayListItem, TQStyleSheetItem::ListDisc ); - clearUndoRedo(); - drawCursor( FALSE ); - repaintChanged(); - drawCursor( TRUE ); - break; - } - if (overWrite && !cursor->atParagEnd() && !doc->hasSelection(TQTextDocument::Standard)) { - doKeyboardAction(ActionDelete); - clearUndoRedoInfo = FALSE; - } - TQString t = e->text(); -#ifdef TQ_WS_X11 - extern bool tqt_hebrew_keyboard_hack; - if ( tqt_hebrew_keyboard_hack ) { - // the X11 keyboard layout is broken and does not reverse - // braces correctly. This is a hack to get halfway correct - // behaviour - TQTextParagraph *p = cursor->paragraph(); - if ( p && p->string() && p->string()->isRightToLeft() ) { - TQChar *c = (TQChar *)t.unicode(); - int l = t.length(); - while( l-- ) { - if ( c->mirrored() ) - *c = c->mirroredChar(); - c++; - } - } - } -#endif - insert( t, TRUE, FALSE ); - break; - } else if ( e->state() & ControlButton ) { - switch ( e->key() ) { - case Key_C: case Key_F16: // Copy key on Sun keyboards - copy(); - break; - case Key_V: - paste(); - break; - case Key_X: - cut(); - break; - case Key_I: case Key_T: case Key_Tab: - if ( !d->tabChangesFocus ) - indent(); - break; - case Key_A: -#if defined(TQ_WS_X11) - moveCursor( MoveLineStart, e->state() & ShiftButton ); -#else - selectAll( TRUE ); -#endif - break; - case Key_B: - moveCursor( MoveBackward, e->state() & ShiftButton ); - break; - case Key_F: - moveCursor( MoveForward, e->state() & ShiftButton ); - break; - case Key_D: - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - removeSelectedText(); - break; - } - doKeyboardAction( ActionDelete ); - clearUndoRedoInfo = FALSE; - break; - case Key_H: - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - removeSelectedText(); - break; - } - if ( !cursor->paragraph()->prev() && - cursor->atParagStart() ) - break; - - doKeyboardAction( ActionBackspace ); - clearUndoRedoInfo = FALSE; - break; - case Key_E: - moveCursor( MoveLineEnd, e->state() & ShiftButton ); - break; - case Key_N: - moveCursor( MoveDown, e->state() & ShiftButton ); - break; - case Key_P: - moveCursor( MoveUp, e->state() & ShiftButton ); - break; - case Key_Z: - if(e->state() & ShiftButton) - redo(); - else - undo(); - break; - case Key_Y: - redo(); - break; - case Key_K: - doKeyboardAction( ActionKill ); - break; -#if defined(TQ_WS_WIN) - case Key_Insert: - copy(); - break; - case Key_Delete: - del(); - break; -#endif - default: - unknownKey = FALSE; - break; - } - } else { - unknownKey = TRUE; - } - } - } - - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); - if ( clearUndoRedoInfo ) - clearUndoRedo(); - changeIntervalTimer->start( 100, TRUE ); - if ( unknownKey ) - e->ignore(); -} - -/*! - This function is not intended as polymorphic usage. Just a shared code - fragment that calls TQWidget::sendMouseEventToInputContext() easily for this - class. - */ -bool TQTextEdit::sendMouseEventToInputContext( TQMouseEvent *e ) -{ -#ifndef TQT_NO_IM - if ( d->composeMode() ) { - TQTextCursor c( doc ); - if ( c.place( e->pos(), doc->firstParagraph(), FALSE, FALSE, FALSE ) ) { - int mousePos = c.index() - d->preeditStart; - if ( cursor->globalY() == c.globalY() && - mousePos >= 0 && mousePos < d->preeditLength ) { - TQWidget::sendMouseEventToInputContext( mousePos, e->type(), - e->button(), e->state() ); - } - } else if ( e->type() != TQEvent::MouseMove ) { - // send button events on out of preedit - TQWidget::sendMouseEventToInputContext( -1, e->type(), - e->button(), e->state() ); - } - return TRUE; - } -#endif - return FALSE; -} - - -/*! - \reimp -*/ -void TQTextEdit::imStartEvent( TQIMEvent *e ) -{ - if ( isReadOnly() ) { - e->ignore(); - return; - } - - if ( hasSelectedText() ) - removeSelectedText(); - d->preeditStart = cursor->index(); - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::IME; -} - -/*! - \reimp -*/ -void TQTextEdit::imComposeEvent( TQIMEvent *e ) -{ - if ( isReadOnly() ) { - e->ignore(); - return; - } - - doc->removeSelection( TQTextDocument::IMCompositionText ); - doc->removeSelection( TQTextDocument::IMSelectionText ); - - if ( d->composeMode() && cursor->paragraph() ) - cursor->paragraph()->remove( d->preeditStart, d->preeditLength ); - cursor->setIndex( d->preeditStart ); - d->preeditLength = e->text().length(); - - int sellen = e->selectionLength(); - uint insertionFlags = CheckNewLines | RemoveSelected | AsIMCompositionText; - if ( sellen > 0 ) { - insertionFlags |= WithIMSelection; - } - insert( e->text(), insertionFlags ); - // insert can trigger an imEnd event as it emits a textChanged signal, so better - // be careful - if(d->preeditStart != -1) { - cursor->setIndex( d->preeditStart + d->preeditLength ); - TQTextCursor c = *cursor; - cursor->setIndex( d->preeditStart ); - doc->setSelectionStart( TQTextDocument::IMCompositionText, *cursor ); - doc->setSelectionEnd( TQTextDocument::IMCompositionText, c ); - - cursor->setIndex( d->preeditStart + e->cursorPos() ); - - if ( sellen > 0 ) { - cursor->setIndex( d->preeditStart + e->cursorPos() + sellen ); - c = *cursor; - cursor->setIndex( d->preeditStart + e->cursorPos() ); - doc->setSelectionStart( TQTextDocument::IMSelectionText, *cursor ); - doc->setSelectionEnd( TQTextDocument::IMSelectionText, c ); -#if 0 - // Disabled for Asian input method that shows candidate - // window. This behavior is same as TQt/E 2.3.7 which supports - // Asian input methods. Asian input methods need start point - // of IM selection text to place candidate window as adjacent - // to the selection text. - cursor->setIndex( d->preeditStart + d->preeditLength ); -#endif - } - } - - updateMicroFocusHint(); - repaintChanged(); -} - -/*! - \reimp -*/ -void TQTextEdit::imEndEvent( TQIMEvent *e ) -{ - if ( isReadOnly() ) { - e->ignore(); - return; - } - - doc->removeSelection( TQTextDocument::IMCompositionText ); - doc->removeSelection( TQTextDocument::IMSelectionText ); - - if (undoRedoInfo.type == UndoRedoInfo::IME) - undoRedoInfo.type = UndoRedoInfo::Invalid; - - if ( d->composeMode() && cursor->paragraph() ) - cursor->paragraph()->remove( d->preeditStart, d->preeditLength ); - if ( d->preeditStart >= 0 ) { - cursor->setIndex( d->preeditStart ); - //TODO: TQt 4 we should use the new virtual insert function - insert( e->text(), FALSE ); - } - d->preeditStart = d->preeditLength = -1; - - repaintChanged(); -} - - -static bool qtextedit_ignore_readonly = FALSE; - -/*! - Executes keyboard action \a action. This is normally called by a - key event handler. -*/ - -void TQTextEdit::doKeyboardAction( KeyboardAction action ) -{ - if ( isReadOnly() && !qtextedit_ignore_readonly ) - return; - - if ( cursor->nestedDepth() != 0 ) // #### for 3.0, disable editing of tables as this is not advanced enough - return; - - lastFormatted = cursor->paragraph(); - drawCursor( FALSE ); - bool doUpdateCurrentFormat = TRUE; - - switch ( action ) { - case ActionWordDelete: - case ActionDelete: - if ( action == ActionDelete && !cursor->atParagEnd() ) { - if ( undoEnabled ) { - checkUndoRedoInfo( UndoRedoInfo::Delete ); - if ( !undoRedoInfo.valid() ) { - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.index = cursor->index(); - undoRedoInfo.d->text = TQString::null; - } - int idx = cursor->index(); - do { - undoRedoInfo.d->text.insert( undoRedoInfo.d->text.length(), cursor->paragraph()->at( idx++ ), TRUE ); - } while ( !cursor->paragraph()->string()->validCursorPosition( idx ) ); - } - cursor->remove(); - } else { - clearUndoRedo(); - doc->setSelectionStart( TQTextDocument::Temp, *cursor ); - if ( action == ActionWordDelete && !cursor->atParagEnd() ) { - cursor->gotoNextWord(); - } else { - cursor->gotoNextLetter(); - } - doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); - removeSelectedText( TQTextDocument::Temp ); - } - break; - case ActionWordBackspace: - case ActionBackspace: - if ( textFormat() == TQt::RichText - && (cursor->paragraph()->isListItem() - || cursor->paragraph()->listDepth() ) - && cursor->index() == 0 ) { - if ( undoEnabled ) { - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Style; - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.eid = undoRedoInfo.id; - undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); - } - int ldepth = cursor->paragraph()->listDepth(); - if ( cursor->paragraph()->isListItem() && ldepth == 1 ) { - cursor->paragraph()->setListItem( FALSE ); - } else if ( TQMAX( ldepth, 1 ) == 1 ) { - cursor->paragraph()->setListItem( FALSE ); - cursor->paragraph()->setListDepth( 0 ); - } else { - cursor->paragraph()->setListDepth( ldepth - 1 ); - } - clearUndoRedo(); - lastFormatted = cursor->paragraph(); - repaintChanged(); - drawCursor( TRUE ); - return; - } - - if ( action == ActionBackspace && !cursor->atParagStart() ) { - if ( undoEnabled ) { - checkUndoRedoInfo( UndoRedoInfo::Delete ); - if ( !undoRedoInfo.valid() ) { - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.index = cursor->index(); - undoRedoInfo.d->text = TQString::null; - } - undoRedoInfo.d->text.insert( 0, cursor->paragraph()->at( cursor->index()-1 ), TRUE ); - undoRedoInfo.index = cursor->index()-1; - } - cursor->removePreviousChar(); - lastFormatted = cursor->paragraph(); - } else if ( cursor->paragraph()->prev() - || (action == ActionWordBackspace - && !cursor->atParagStart()) ) { - clearUndoRedo(); - doc->setSelectionStart( TQTextDocument::Temp, *cursor ); - if ( action == ActionWordBackspace && !cursor->atParagStart() ) { - cursor->gotoPreviousWord(); - } else { - cursor->gotoPreviousLetter(); - } - doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); - removeSelectedText( TQTextDocument::Temp ); - } - break; - case ActionReturn: - if ( undoEnabled ) { - checkUndoRedoInfo( UndoRedoInfo::Return ); - if ( !undoRedoInfo.valid() ) { - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.index = cursor->index(); - undoRedoInfo.d->text = TQString::null; - } - undoRedoInfo.d->text += "\n"; - } - cursor->splitAndInsertEmptyParagraph(); - if ( cursor->paragraph()->prev() ) { - lastFormatted = cursor->paragraph()->prev(); - lastFormatted->invalidate( 0 ); - } - doUpdateCurrentFormat = FALSE; - break; - case ActionKill: - clearUndoRedo(); - doc->setSelectionStart( TQTextDocument::Temp, *cursor ); - if ( cursor->atParagEnd() ) - cursor->gotoNextLetter(); - else - cursor->setIndex( cursor->paragraph()->length() - 1 ); - doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); - removeSelectedText( TQTextDocument::Temp ); - break; - } - - formatMore(); - repaintChanged(); - ensureCursorVisible(); - drawCursor( TRUE ); - updateMicroFocusHint(); - if ( doUpdateCurrentFormat ) - updateCurrentFormat(); - setModified(); - emit textChanged(); -} - -void TQTextEdit::readFormats( TQTextCursor &c1, TQTextCursor &c2, TQTextString &text, bool fillStyles ) -{ -#ifndef TQT_NO_DATASTREAM - TQDataStream styleStream( undoRedoInfo.styleInformation, IO_WriteOnly ); -#endif - c2.restoreState(); - c1.restoreState(); - int lastIndex = text.length(); - if ( c1.paragraph() == c2.paragraph() ) { - for ( int i = c1.index(); i < c2.index(); ++i ) - text.insert( lastIndex + i - c1.index(), c1.paragraph()->at( i ), TRUE ); -#ifndef TQT_NO_DATASTREAM - if ( fillStyles ) { - styleStream << (int) 1; - c1.paragraph()->writeStyleInformation( styleStream ); - } -#endif - } else { - int i; - for ( i = c1.index(); i < c1.paragraph()->length()-1; ++i ) - text.insert( lastIndex++, c1.paragraph()->at( i ), TRUE ); - int num = 2; // start and end, being different - text += "\n"; lastIndex++; - - if (c1.paragraph()->next() != c2.paragraph()) { - num += text.appendParagraphs(c1.paragraph()->next(), c2.paragraph()); - lastIndex = text.length(); - } - - for ( i = 0; i < c2.index(); ++i ) - text.insert( i + lastIndex, c2.paragraph()->at( i ), TRUE ); -#ifndef TQT_NO_DATASTREAM - if ( fillStyles ) { - styleStream << num; - for ( TQTextParagraph *p = c1.paragraph(); --num >= 0; p = p->next() ) - p->writeStyleInformation( styleStream ); - } -#endif - } -} - -/*! - Removes the selection \a selNum (by default 0). This does not - remove the selected text. - - \sa removeSelectedText() -*/ - -void TQTextEdit::removeSelection( int selNum ) -{ - doc->removeSelection( selNum ); - repaintChanged(); -} - -/*! - Deletes the text of selection \a selNum (by default, the default - selection, 0). If there is no selected text nothing happens. - - \sa selectedText removeSelection() -*/ - -void TQTextEdit::removeSelectedText( int selNum ) -{ - if(selNum != 0) - resetInputContext(); - - TQTextCursor c1 = doc->selectionStartCursor( selNum ); - c1.restoreState(); - TQTextCursor c2 = doc->selectionEndCursor( selNum ); - c2.restoreState(); - - // ### no support for editing tables yet, plus security for broken selections - if ( c1.nestedDepth() || c2.nestedDepth() ) - return; - - for ( int i = 0; i < (int)doc->numSelections(); ++i ) { - if ( i == selNum ) - continue; - doc->removeSelection( i ); - } - - drawCursor( FALSE ); - if ( undoEnabled ) { - checkUndoRedoInfo( UndoRedoInfo::RemoveSelected ); - if ( !undoRedoInfo.valid() ) { - doc->selectionStart( selNum, undoRedoInfo.id, undoRedoInfo.index ); - undoRedoInfo.d->text = TQString::null; - } - readFormats( c1, c2, undoRedoInfo.d->text, TRUE ); - } - - doc->removeSelectedText( selNum, cursor ); - if ( cursor->isValid() ) { - lastFormatted = 0; // make sync a noop - ensureCursorVisible(); - lastFormatted = cursor->paragraph(); - formatMore(); - repaintContents( FALSE ); - ensureCursorVisible(); - drawCursor( TRUE ); - clearUndoRedo(); -#if defined(TQ_WS_WIN) - // there seems to be a problem with repainting or erasing the area - // of the scrollview which is not the contents on windows - if ( contentsHeight() < visibleHeight() ) - viewport()->repaint( 0, contentsHeight(), visibleWidth(), visibleHeight() - contentsHeight(), TRUE ); -#endif -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - updateMicroFocusHint(); - } else { - delete cursor; - cursor = new TQTextCursor( doc ); - drawCursor( TRUE ); - repaintContents( TRUE ); - } - setModified(); - emit textChanged(); - emit selectionChanged(); - emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); -} - -/*! - Moves the text cursor according to \a action. This is normally - used by some key event handler. \a select specifies whether the - text between the current cursor position and the new position - should be selected. -*/ - -void TQTextEdit::moveCursor( CursorAction action, bool select ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return; -#endif -#ifdef TQ_WS_MACX - TQTextCursor c1 = *cursor; - TQTextCursor c2; -#endif - drawCursor( FALSE ); - if ( select ) { - if ( !doc->hasSelection( TQTextDocument::Standard ) ) - doc->setSelectionStart( TQTextDocument::Standard, *cursor ); - moveCursor( action ); -#ifdef TQ_WS_MACX - c2 = *cursor; - if (c1 == c2) - if (action == MoveDown || action == MovePgDown) - moveCursor( MoveEnd ); - else if (action == MoveUp || action == MovePgUp) - moveCursor( MoveHome ); -#endif - if ( doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) ) { - cursor->paragraph()->document()->nextDoubleBuffered = TRUE; - repaintChanged(); - } else { - drawCursor( TRUE ); - } - ensureCursorVisible(); - emit selectionChanged(); - emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); - } else { -#ifdef TQ_WS_MACX - TQTextCursor cStart = doc->selectionStartCursor( TQTextDocument::Standard ); - TQTextCursor cEnd = doc->selectionEndCursor( TQTextDocument::Standard ); - bool redraw = doc->removeSelection( TQTextDocument::Standard ); - if (redraw && action == MoveDown) - *cursor = cEnd; - else if (redraw && action == MoveUp) - *cursor = cStart; - if (redraw && action == MoveForward) - *cursor = cEnd; - else if (redraw && action == MoveBackward) - *cursor = cStart; - else - moveCursor( action ); - c2 = *cursor; - if (c1 == c2) - if (action == MoveDown) - moveCursor( MoveEnd ); - else if (action == MoveUp) - moveCursor( MoveHome ); -#else - bool redraw = doc->removeSelection( TQTextDocument::Standard ); - moveCursor( action ); -#endif - if ( !redraw ) { - ensureCursorVisible(); - drawCursor( TRUE ); - } else { - cursor->paragraph()->document()->nextDoubleBuffered = TRUE; - repaintChanged(); - ensureCursorVisible(); - drawCursor( TRUE ); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - } - if ( redraw ) { - emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); - emit selectionChanged(); - } - } - - drawCursor( TRUE ); - updateCurrentFormat(); - updateMicroFocusHint(); -} - -/*! - \overload -*/ - -void TQTextEdit::moveCursor( CursorAction action ) -{ - resetInputContext(); - switch ( action ) { - case MoveBackward: - cursor->gotoPreviousLetter(); - break; - case MoveWordBackward: - cursor->gotoPreviousWord(); - break; - case MoveForward: - cursor->gotoNextLetter(); - break; - case MoveWordForward: - cursor->gotoNextWord(); - break; - case MoveUp: - cursor->gotoUp(); - break; - case MovePgUp: - cursor->gotoPageUp( visibleHeight() ); - break; - case MoveDown: - cursor->gotoDown(); - break; - case MovePgDown: - cursor->gotoPageDown( visibleHeight() ); - break; - case MoveLineStart: - cursor->gotoLineStart(); - break; - case MoveHome: - cursor->gotoHome(); - break; - case MoveLineEnd: - cursor->gotoLineEnd(); - break; - case MoveEnd: - ensureFormatted( doc->lastParagraph() ); - cursor->gotoEnd(); - break; - } - updateMicroFocusHint(); - updateCurrentFormat(); -} - -/*! - \reimp -*/ - -void TQTextEdit::resizeEvent( TQResizeEvent *e ) -{ - TQScrollView::resizeEvent( e ); - if ( doc->visibleWidth() == 0 ) - doResize(); -} - -/*! - \reimp -*/ - -void TQTextEdit::viewportResizeEvent( TQResizeEvent *e ) -{ - TQScrollView::viewportResizeEvent( e ); - if ( e->oldSize().width() != e->size().width() ) { - bool stayAtBottom = e->oldSize().height() != e->size().height() && - contentsY() > 0 && contentsY() >= doc->height() - e->oldSize().height(); - doResize(); - if ( stayAtBottom ) - scrollToBottom(); - } -} - -/*! - Ensures that the cursor is visible by scrolling the text edit if - necessary. - - \sa setCursorPosition() -*/ - -void TQTextEdit::ensureCursorVisible() -{ - // Not visible or the user is draging the window, so don't position to caret yet - if ( !isUpdatesEnabled() || !isVisible() || isHorizontalSliderPressed() || isVerticalSliderPressed() ) { - d->ensureCursorVisibleInShowEvent = TRUE; - return; - } - sync(); - TQTextStringChar *chr = cursor->paragraph()->at( cursor->index() ); - int h = cursor->paragraph()->lineHeightOfChar( cursor->index() ); - int x = cursor->paragraph()->rect().x() + chr->x + cursor->offsetX(); - int y = 0; int dummy; - cursor->paragraph()->lineHeightOfChar( cursor->index(), &dummy, &y ); - y += cursor->paragraph()->rect().y() + cursor->offsetY(); - int w = 1; - ensureVisible( x, y + h / 2, w, h / 2 + 2 ); -} - -/*! - \internal -*/ -void TQTextEdit::sliderReleased() -{ - if ( d->ensureCursorVisibleInShowEvent && isVisible() ) { - d->ensureCursorVisibleInShowEvent = FALSE; - ensureCursorVisible(); - } -} - -/*! - \internal -*/ -void TQTextEdit::drawCursor( bool visible ) -{ - if ( !isUpdatesEnabled() || - !viewport()->isUpdatesEnabled() || - !cursor->paragraph() || - !cursor->paragraph()->isValid() || - ( !style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) && - ( d->optimMode ? optimHasSelection() : doc->hasSelection( TQTextDocument::Standard, TRUE ))) || - ( visible && !hasFocus() && !viewport()->hasFocus() && !inDnD ) || - doc->hasSelection( TQTextDocument::IMSelectionText ) || - isReadOnly() ) - return; - - // Asian users regard selection text as cursor on candidate - // selection phase of input method, so ordinary cursor should be - // invisible if IM selection text exists. - if ( doc->hasSelection( TQTextDocument::IMSelectionText ) ) { - visible = FALSE; - } - - TQPainter p( viewport() ); - TQRect r( cursor->topParagraph()->rect() ); - cursor->paragraph()->setChanged( TRUE ); - p.translate( -contentsX() + cursor->totalOffsetX(), -contentsY() + cursor->totalOffsetY() ); - TQPixmap *pix = 0; - TQColorGroup cg( colorGroup() ); - const TQColorGroup::ColorRole backRole = TQPalette::backgroundRoleFromMode(backgroundMode()); - if ( cursor->paragraph()->background() ) - cg.setBrush( backRole, *cursor->paragraph()->background() ); - else if ( doc->paper() ) - cg.setBrush( backRole, *doc->paper() ); - p.setBrushOrigin( -contentsX(), -contentsY() ); - cursor->paragraph()->document()->nextDoubleBuffered = TRUE; - if ( !cursor->nestedDepth() ) { - int h = cursor->paragraph()->lineHeightOfChar( cursor->index() ); - int dist = 5; - if ( ( cursor->paragraph()->alignment() & TQt::AlignJustify ) == TQt::AlignJustify ) - dist = 50; - int x = r.x() - cursor->totalOffsetX() + cursor->x() - dist; - x = TQMAX( x, 0 ); - p.setClipRect( TQRect( x - contentsX(), - r.y() - cursor->totalOffsetY() + cursor->y() - contentsY(), 2 * dist, h ) ); - doc->drawParagraph( &p, cursor->paragraph(), x, - r.y() - cursor->totalOffsetY() + cursor->y(), 2 * dist, h, pix, cg, visible, cursor ); - } else { - doc->drawParagraph( &p, cursor->paragraph(), r.x() - cursor->totalOffsetX(), - r.y() - cursor->totalOffsetY(), r.width(), r.height(), - pix, cg, visible, cursor ); - } - cursorVisible = visible; -} - -enum { - IdUndo = 0, - IdRedo = 1, - IdCut = 2, - IdCopy = 3, - IdPaste = 4, - IdClear = 5, - IdSelectAll = 6 -}; - -/*! - \reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQTextEdit::contentsWheelEvent( TQWheelEvent *e ) -{ - if ( isReadOnly() ) { - if ( e->state() & ControlButton ) { - if ( e->delta() > 0 ) - zoomOut(); - else if ( e->delta() < 0 ) - zoomIn(); - return; - } - } - TQScrollView::contentsWheelEvent( e ); -} -#endif - -/*! - \reimp -*/ - -void TQTextEdit::contentsMousePressEvent( TQMouseEvent *e ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimMousePressEvent( e ); - return; - } -#endif - - if ( sendMouseEventToInputContext( e ) ) - return; - - if ( d->trippleClickTimer->isActive() && - ( e->globalPos() - d->trippleClickPoint ).manhattanLength() < - TQApplication::startDragDistance() ) { - TQTextCursor c1 = *cursor; - TQTextCursor c2 = *cursor; - c1.gotoLineStart(); - c2.gotoLineEnd(); - doc->setSelectionStart( TQTextDocument::Standard, c1 ); - doc->setSelectionEnd( TQTextDocument::Standard, c2 ); - *cursor = c2; - repaintChanged(); - mousePressed = TRUE; - return; - } - - clearUndoRedo(); - TQTextCursor oldCursor = *cursor; - TQTextCursor c = *cursor; - mousePos = e->pos(); - mightStartDrag = FALSE; - pressedLink = TQString::null; - d->pressedName = TQString::null; - - if ( e->button() == LeftButton ) { - mousePressed = TRUE; - drawCursor( FALSE ); - placeCursor( e->pos() ); - ensureCursorVisible(); - - if ( isReadOnly() && linksEnabled() ) { - TQTextCursor c = *cursor; - placeCursor( e->pos(), &c, TRUE ); - if ( c.paragraph() && c.paragraph()->at( c.index() ) && - c.paragraph()->at( c.index() )->isAnchor() ) { - pressedLink = c.paragraph()->at( c.index() )->anchorHref(); - d->pressedName = c.paragraph()->at( c.index() )->anchorName(); - } - } - -#ifndef TQT_NO_DRAGANDDROP - if ( doc->inSelection( TQTextDocument::Standard, e->pos() ) ) { - mightStartDrag = TRUE; - drawCursor( TRUE ); - dragStartTimer->start( TQApplication::startDragTime(), TRUE ); - dragStartPos = e->pos(); - return; - } -#endif - - bool redraw = FALSE; - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - if ( !( e->state() & ShiftButton ) ) { - redraw = doc->removeSelection( TQTextDocument::Standard ); - doc->setSelectionStart( TQTextDocument::Standard, *cursor ); - } else { - redraw = doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) || redraw; - } - } else { - if ( isReadOnly() || !( e->state() & ShiftButton ) ) { - doc->setSelectionStart( TQTextDocument::Standard, *cursor ); - } else { - doc->setSelectionStart( TQTextDocument::Standard, c ); - redraw = doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) || redraw; - } - } - - for ( int i = 1; i < doc->numSelections(); ++i ) // start with 1 as we don't want to remove the Standard-Selection - redraw = doc->removeSelection( i ) || redraw; - - if ( !redraw ) { - drawCursor( TRUE ); - } else { - repaintChanged(); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - } - } else if ( e->button() == MidButton ) { - bool redraw = doc->removeSelection( TQTextDocument::Standard ); - if ( !redraw ) { - drawCursor( TRUE ); - } else { - repaintChanged(); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - } - } - - if ( *cursor != oldCursor ) - updateCurrentFormat(); -} - -/*! - \reimp -*/ - -void TQTextEdit::contentsMouseMoveEvent( TQMouseEvent *e ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimMouseMoveEvent( e ); - return; - } -#endif - if ( sendMouseEventToInputContext( e ) ) { - // don't return from here to avoid cursor vanishing - } else if ( mousePressed ) { -#ifndef TQT_NO_DRAGANDDROP - if ( mightStartDrag ) { - dragStartTimer->stop(); - if ( ( e->pos() - dragStartPos ).manhattanLength() > TQApplication::startDragDistance() ) { - TQGuardedPtr<TQTextEdit> guard( this ); - startDrag(); - if (guard.isNull()) // we got deleted during the dnd - return; - } -#ifndef TQT_NO_CURSOR - if ( !isReadOnly() ) - viewport()->setCursor( ibeamCursor ); -#endif - return; - } -#endif - mousePos = e->pos(); - handleMouseMove( mousePos ); - oldMousePos = mousePos; - } - -#ifndef TQT_NO_CURSOR - if ( !isReadOnly() && !mousePressed ) { - if ( doc->hasSelection( TQTextDocument::Standard ) && doc->inSelection( TQTextDocument::Standard, e->pos() ) ) - viewport()->setCursor( arrowCursor ); - else - viewport()->setCursor( ibeamCursor ); - } -#endif - updateCursor( e->pos() ); -} - -void TQTextEdit::copyToClipboard() -{ -#ifndef TQT_NO_CLIPBOARD - if (TQApplication::clipboard()->supportsSelection()) { - d->clipboard_mode = TQClipboard::Selection; - - // don't listen to selection changes - disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), this, 0); - copy(); - // listen to selection changes - connect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), - this, TQ_SLOT(clipboardChanged()) ); - - d->clipboard_mode = TQClipboard::Clipboard; - } -#endif -} - -/*! - \reimp -*/ - -void TQTextEdit::contentsMouseReleaseEvent( TQMouseEvent * e ) -{ - if ( !inDoubleClick && !d->composeMode() ) { // could be the release of a dblclick - int para = 0; - int index = charAt( e->pos(), ¶ ); - emit clicked( para, index ); - } -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimMouseReleaseEvent( e ); - return; - } -#endif - if ( sendMouseEventToInputContext( e ) ) - return; - TQTextCursor oldCursor = *cursor; - if ( scrollTimer->isActive() ) - scrollTimer->stop(); -#ifndef TQT_NO_DRAGANDDROP - if ( dragStartTimer->isActive() ) - dragStartTimer->stop(); - if ( mightStartDrag ) { - selectAll( FALSE ); - mousePressed = FALSE; - } -#endif - bool mouseWasPressed = mousePressed; - if ( mousePressed ) { - mousePressed = FALSE; - copyToClipboard(); - } -#ifndef TQT_NO_CLIPBOARD - else if ( e->button() == MidButton && !isReadOnly() ) { - // only do middle-click pasting on systems that have selections (ie. X11) - if (TQApplication::clipboard()->supportsSelection()) { - drawCursor( FALSE ); - placeCursor( e->pos() ); - ensureCursorVisible(); - doc->setSelectionStart( TQTextDocument::Standard, oldCursor ); - bool redraw = FALSE; - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - redraw = doc->removeSelection( TQTextDocument::Standard ); - doc->setSelectionStart( TQTextDocument::Standard, *cursor ); - } else { - doc->setSelectionStart( TQTextDocument::Standard, *cursor ); - } - // start with 1 as we don't want to remove the Standard-Selection - for ( int i = 1; i < doc->numSelections(); ++i ) - redraw = doc->removeSelection( i ) || redraw; - if ( !redraw ) { - drawCursor( TRUE ); - } else { - repaintChanged(); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( ibeamCursor ); -#endif - } - d->clipboard_mode = TQClipboard::Selection; - paste(); - d->clipboard_mode = TQClipboard::Clipboard; - } - } -#endif - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); - if ( oldCursor != *cursor ) - updateCurrentFormat(); - inDoubleClick = FALSE; - -#ifndef TQT_NO_NETWORKPROTOCOL - if ( ( (!onLink.isEmpty() && onLink == pressedLink) - || (!d->onName.isEmpty() && d->onName == d->pressedName)) - && linksEnabled() && mouseWasPressed ) { - if (!onLink.isEmpty()) { - TQUrl u( doc->context(), onLink, TRUE ); - emitLinkClicked( u.toString( FALSE, FALSE ) ); - } - if (::tqt_cast<TQTextBrowser*>(this)) { // change for 4.0 - TQConnectionList *clist = receivers( - "anchorClicked(const TQString&,const TQString&)"); - if (!signalsBlocked() && clist) { - TQUObject o[3]; - static_QUType_TQString.set(o+1, d->onName); - static_QUType_TQString.set(o+2, onLink); - activate_signal( clist, o); - } - } - - // emitting linkClicked() may result in that the cursor winds - // up hovering over a different valid link - check this and - // set the appropriate cursor shape - updateCursor( e->pos() ); - } -#endif - drawCursor( TRUE ); - if ( !doc->hasSelection( TQTextDocument::Standard, TRUE ) ) - doc->removeSelection( TQTextDocument::Standard ); - - emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); - emit selectionChanged(); -} - -/*! - \reimp -*/ - -void TQTextEdit::contentsMouseDoubleClickEvent( TQMouseEvent * e ) -{ - if ( e->button() != TQt::LeftButton && !d->composeMode() ) { - e->ignore(); - return; - } - int para = 0; - int index = charAt( e->pos(), ¶ ); -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - TQString str = d->od->lines[ LOGOFFSET(para) ]; - int startIdx = index, endIdx = index, i; - if ( !str[ index ].isSpace() ) { - i = startIdx; - // find start of word - while ( i >= 0 && !str[ i ].isSpace() ) { - startIdx = i--; - } - i = endIdx; - // find end of word.. - while ( (uint) i < str.length() && !str[ i ].isSpace() ) { - endIdx = ++i; - } - // ..and start of next - while ( (uint) i < str.length() && str[ i ].isSpace() ) { - endIdx = ++i; - } - optimSetSelection( para, startIdx, para, endIdx ); - repaintContents( FALSE ); - } - } else -#endif - { - if ( sendMouseEventToInputContext( e ) ) - return; - - TQTextCursor c1 = *cursor; - TQTextCursor c2 = *cursor; -#if defined(Q_OS_MAC) - TQTextParagraph *para = cursor->paragraph(); - if ( cursor->isValid() ) { - if ( para->at( cursor->index() )->c.isLetterOrNumber() ) { - while ( c1.index() > 0 && - c1.paragraph()->at( c1.index()-1 )->c.isLetterOrNumber() ) - c1.gotoPreviousLetter(); - while ( c2.paragraph()->at( c2.index() )->c.isLetterOrNumber() && - !c2.atParagEnd() ) - c2.gotoNextLetter(); - } else if ( para->at( cursor->index() )->c.isSpace() ) { - while ( c1.index() > 0 && - c1.paragraph()->at( c1.index()-1 )->c.isSpace() ) - c1.gotoPreviousLetter(); - while ( c2.paragraph()->at( c2.index() )->c.isSpace() && - !c2.atParagEnd() ) - c2.gotoNextLetter(); - } else if ( !c2.atParagEnd() ) { - c2.gotoNextLetter(); - } - } -#else - if ( cursor->index() > 0 && !cursor->paragraph()->at( cursor->index()-1 )->c.isSpace() ) - c1.gotoPreviousWord(); - if ( !cursor->paragraph()->at( cursor->index() )->c.isSpace() && !cursor->atParagEnd() ) - c2.gotoNextWord(); -#endif - doc->setSelectionStart( TQTextDocument::Standard, c1 ); - doc->setSelectionEnd( TQTextDocument::Standard, c2 ); - - *cursor = c2; - - repaintChanged(); - - d->trippleClickTimer->start( tqApp->doubleClickInterval(), TRUE ); - d->trippleClickPoint = e->globalPos(); - } - inDoubleClick = TRUE; - mousePressed = TRUE; - emit doubleClicked( para, index ); -} - -#ifndef TQT_NO_DRAGANDDROP - -/*! - \reimp -*/ - -void TQTextEdit::contentsDragEnterEvent( TQDragEnterEvent *e ) -{ - if ( isReadOnly() || !TQTextDrag::canDecode( e ) ) { - e->ignore(); - return; - } - e->acceptAction(); - inDnD = TRUE; -} - -/*! - \reimp -*/ - -void TQTextEdit::contentsDragMoveEvent( TQDragMoveEvent *e ) -{ - if ( isReadOnly() || !TQTextDrag::canDecode( e ) ) { - e->ignore(); - return; - } - drawCursor( FALSE ); - placeCursor( e->pos(), cursor ); - drawCursor( TRUE ); - e->acceptAction(); -} - -/*! - \reimp -*/ - -void TQTextEdit::contentsDragLeaveEvent( TQDragLeaveEvent * ) -{ - drawCursor( FALSE ); - inDnD = FALSE; -} - -/*! - \reimp -*/ - -void TQTextEdit::contentsDropEvent( TQDropEvent *e ) -{ - if ( isReadOnly() ) - return; - inDnD = FALSE; - e->acceptAction(); - bool intern = FALSE; - if ( TQRichTextDrag::canDecode( e ) ) { - bool hasSel = doc->hasSelection( TQTextDocument::Standard ); - bool internalDrag = e->source() == this || e->source() == viewport(); - int dropId, dropIndex; - TQTextCursor insertCursor = *cursor; - dropId = cursor->paragraph()->paragId(); - dropIndex = cursor->index(); - if ( hasSel && internalDrag ) { - TQTextCursor c1, c2; - int selStartId, selStartIndex; - int selEndId, selEndIndex; - c1 = doc->selectionStartCursor( TQTextDocument::Standard ); - c1.restoreState(); - c2 = doc->selectionEndCursor( TQTextDocument::Standard ); - c2.restoreState(); - selStartId = c1.paragraph()->paragId(); - selStartIndex = c1.index(); - selEndId = c2.paragraph()->paragId(); - selEndIndex = c2.index(); - if ( ( ( dropId > selStartId ) || - ( dropId == selStartId && dropIndex > selStartIndex ) ) && - ( ( dropId < selEndId ) || - ( dropId == selEndId && dropIndex <= selEndIndex ) ) ) - insertCursor = c1; - if ( dropId == selEndId && dropIndex > selEndIndex ) { - insertCursor = c1; - if ( selStartId == selEndId ) { - insertCursor.setIndex( dropIndex - - ( selEndIndex - selStartIndex ) ); - } else { - insertCursor.setIndex( dropIndex - selEndIndex + - selStartIndex ); - } - } - } - - if ( internalDrag && e->action() == TQDropEvent::Move ) { - removeSelectedText(); - intern = TRUE; - doc->removeSelection( TQTextDocument::Standard ); - } else { - doc->removeSelection( TQTextDocument::Standard ); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - } - drawCursor( FALSE ); - cursor->setParagraph( insertCursor.paragraph() ); - cursor->setIndex( insertCursor.index() ); - drawCursor( TRUE ); - if ( !cursor->nestedDepth() ) { - TQString subType = "plain"; - if ( textFormat() != PlainText ) { - if ( e->provides( "application/x-qrichtext" ) ) - subType = "x-qrichtext"; - } -#ifndef TQT_NO_CLIPBOARD - pasteSubType( subType.latin1(), e ); -#endif - // emit appropriate signals. - emit selectionChanged(); - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); - } else { - if ( intern ) - undo(); - e->ignore(); - } - } -} - -#endif - -/*! - \reimp -*/ -void TQTextEdit::contentsContextMenuEvent( TQContextMenuEvent *e ) -{ - e->accept(); -#ifndef TQT_NO_IM - if ( d->composeMode() ) - return; -#endif - - clearUndoRedo(); - mousePressed = FALSE; - -#ifndef TQT_NO_POPUPMENU - TQGuardedPtr<TQTextEdit> that = this; - TQGuardedPtr<TQPopupMenu> popup = createPopupMenu( e->pos() ); - if ( !popup ) - popup = createPopupMenu(); - if ( !popup ) - return; - - int r = popup->exec( e->globalPos() ); - delete popup; - if (!that) - return; - - if ( r == d->id[ IdClear ] ) - clear(); - else if ( r == d->id[ IdSelectAll ] ) { - selectAll(); -#ifndef TQT_NO_CLIPBOARD - // if the clipboard support selections, put the newly selected text into - // the clipboard - if (TQApplication::clipboard()->supportsSelection()) { - d->clipboard_mode = TQClipboard::Selection; - - // don't listen to selection changes - disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), this, 0); - copy(); - // listen to selection changes - connect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), - this, TQ_SLOT(clipboardChanged()) ); - - d->clipboard_mode = TQClipboard::Clipboard; - } -#endif - } else if ( r == d->id[ IdUndo ] ) - undo(); - else if ( r == d->id[ IdRedo ] ) - redo(); -#ifndef TQT_NO_CLIPBOARD - else if ( r == d->id[ IdCut ] ) - cut(); - else if ( r == d->id[ IdCopy ] ) - copy(); - else if ( r == d->id[ IdPaste ] ) - paste(); -#endif -#endif -} - - -void TQTextEdit::autoScrollTimerDone() -{ - if ( mousePressed ) - handleMouseMove( viewportToContents( viewport()->mapFromGlobal( TQCursor::pos() ) ) ); -} - -void TQTextEdit::handleMouseMove( const TQPoint& pos ) -{ - if ( !mousePressed ) - return; - - if ( (!scrollTimer->isActive() && pos.y() < contentsY()) || pos.y() > contentsY() + visibleHeight() ) - scrollTimer->start( 100, FALSE ); - else if ( scrollTimer->isActive() && pos.y() >= contentsY() && pos.y() <= contentsY() + visibleHeight() ) - scrollTimer->stop(); - - drawCursor( FALSE ); - TQTextCursor oldCursor = *cursor; - - placeCursor( pos ); - - if ( inDoubleClick ) { - TQTextCursor cl = *cursor; - cl.gotoPreviousWord(); - TQTextCursor cr = *cursor; - cr.gotoNextWord(); - - int diff = TQABS( oldCursor.paragraph()->at( oldCursor.index() )->x - mousePos.x() ); - int ldiff = TQABS( cl.paragraph()->at( cl.index() )->x - mousePos.x() ); - int rdiff = TQABS( cr.paragraph()->at( cr.index() )->x - mousePos.x() ); - - - if ( cursor->paragraph()->lineStartOfChar( cursor->index() ) != - oldCursor.paragraph()->lineStartOfChar( oldCursor.index() ) ) - diff = 0xFFFFFF; - - if ( rdiff < diff && rdiff < ldiff ) - *cursor = cr; - else if ( ldiff < diff && ldiff < rdiff ) - *cursor = cl; - else - *cursor = oldCursor; - - } - ensureCursorVisible(); - - bool redraw = FALSE; - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - redraw = doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) || redraw; - } - - if ( !redraw ) { - drawCursor( TRUE ); - } else { - repaintChanged(); - drawCursor( TRUE ); - } - - if ( currentFormat && currentFormat->key() != cursor->paragraph()->at( cursor->index() )->format()->key() ) { - currentFormat->removeRef(); - currentFormat = doc->formatCollection()->format( cursor->paragraph()->at( cursor->index() )->format() ); - if ( currentFormat->isMisspelled() ) { - currentFormat->removeRef(); - currentFormat = doc->formatCollection()->format( currentFormat->font(), currentFormat->color() ); - } - emit currentFontChanged( currentFormat->font() ); - emit currentColorChanged( currentFormat->color() ); - emit currentVerticalAlignmentChanged( (VerticalAlignment)currentFormat->vAlign() ); - } - - if ( currentAlignment != cursor->paragraph()->alignment() ) { - currentAlignment = cursor->paragraph()->alignment(); - block_set_alignment = TRUE; - emit currentAlignmentChanged( currentAlignment ); - block_set_alignment = FALSE; - } -} - -/*! \internal */ - -void TQTextEdit::placeCursor( const TQPoint &pos, TQTextCursor *c, bool link ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return; -#endif - if ( !c ) - c = cursor; - - resetInputContext(); - c->restoreState(); - TQTextParagraph *s = doc->firstParagraph(); - c->place( pos, s, link ); - updateMicroFocusHint(); -} - - -void TQTextEdit::updateMicroFocusHint() -{ - TQTextCursor c( *cursor ); -#if 0 - // Disabled for Asian input method that shows candidate - // window. This behavior is same as TQt/E 2.3.7 which supports - // Asian input methods. Asian input methods need start point of IM - // selection text to place candidate window as adjacent to the - // selection text. - if ( d->preeditStart != -1 ) { - c.setIndex( d->preeditStart ); - if(doc->hasSelection(TQTextDocument::IMSelectionText)) { - int para, index; - doc->selectionStart(TQTextDocument::IMSelectionText, para, index); - c.setIndex(index); - } - } -#endif - - if ( hasFocus() || viewport()->hasFocus() ) { - int h = c.paragraph()->lineHeightOfChar( cursor->index() ); - if ( !readOnly ) { - TQFont f = c.paragraph()->at( c.index() )->format()->font(); - setMicroFocusHint( c.x() - contentsX() + frameWidth(), - c.y() + cursor->paragraph()->rect().y() - contentsY() + frameWidth(), 0, h, TRUE, &f ); - } - } -} - - - -void TQTextEdit::formatMore() -{ - if ( !lastFormatted ) - return; - - int bottom = contentsHeight(); - int lastTop = -1; - int lastBottom = -1; - int to = 20; - bool firstVisible = FALSE; - TQRect cr( contentsX(), contentsY(), visibleWidth(), visibleHeight() ); - for ( int i = 0; lastFormatted && - ( i < to || ( firstVisible && lastTop < contentsY()+height() ) ); - i++ ) { - lastFormatted->format(); - lastTop = lastFormatted->rect().top(); - lastBottom = lastFormatted->rect().bottom(); - if ( i == 0 ) - firstVisible = lastBottom < cr.bottom(); - bottom = TQMAX( bottom, lastBottom ); - lastFormatted = lastFormatted->next(); - } - - if ( bottom > contentsHeight() ) { - resizeContents( contentsWidth(), TQMAX( doc->height(), bottom ) ); - } else if ( !lastFormatted && lastBottom < contentsHeight() ) { - resizeContents( contentsWidth(), TQMAX( doc->height(), lastBottom ) ); - if ( contentsHeight() < visibleHeight() ) - updateContents( 0, contentsHeight(), visibleWidth(), - visibleHeight() - contentsHeight() ); - } - - if ( lastFormatted ) - formatTimer->start( interval, TRUE ); - else - interval = TQMAX( 0, interval ); -} - -void TQTextEdit::doResize() -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( !d->optimMode ) -#endif - { - if ( wrapMode == FixedPixelWidth ) - return; - doc->setMinimumWidth( -1 ); - resizeContents( 0, 0 ); - doc->setWidth( visibleWidth() ); - doc->invalidate(); - lastFormatted = doc->firstParagraph(); - interval = 0; - formatMore(); - } - repaintContents( FALSE ); -} - -/*! \internal */ - -void TQTextEdit::doChangeInterval() -{ - interval = 0; -} - -/*! - \reimp -*/ - -bool TQTextEdit::eventFilter( TQObject *o, TQEvent *e ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( !d->optimMode && (o == this || o == viewport()) ) { -#else - if ( o == this || o == viewport() ) { -#endif - if ( e->type() == TQEvent::FocusIn ) { - if ( TQApplication::cursorFlashTime() > 0 ) - blinkTimer->start( TQApplication::cursorFlashTime() / 2 ); - drawCursor( TRUE ); - updateMicroFocusHint(); - } else if ( e->type() == TQEvent::FocusOut ) { - blinkTimer->stop(); - drawCursor( FALSE ); - } - } - - if ( o == this && e->type() == TQEvent::PaletteChange ) { - TQColor old( viewport()->colorGroup().color( TQColorGroup::Text ) ); - if ( old != colorGroup().color( TQColorGroup::Text ) ) { - TQColor c( colorGroup().color( TQColorGroup::Text ) ); - doc->setMinimumWidth( -1 ); - doc->setDefaultFormat( doc->formatCollection()->defaultFormat()->font(), c ); - lastFormatted = doc->firstParagraph(); - formatMore(); - repaintChanged(); - } - } - - return TQScrollView::eventFilter( o, e ); -} - -/*! - \obsolete - */ -void TQTextEdit::insert( const TQString &text, bool indent, - bool checkNewLine, bool removeSelected ) -{ - uint f = 0; - if ( indent ) - f |= RedoIndentation; - if ( checkNewLine ) - f |= CheckNewLines; - if ( removeSelected ) - f |= RemoveSelected; - insert( text, f ); -} - -/*! - Inserts \a text at the current cursor position. - - The \a insertionFlags define how the text is inserted. If \c - RedoIndentation is set, the paragraph is re-indented. If \c - CheckNewLines is set, newline characters in \a text result in hard - line breaks (i.e. new paragraphs). If \c checkNewLine is not set, - the behaviour of the editor is undefined if the \a text contains - newlines. (It is not possible to change TQTextEdit's newline handling - behavior, but you can use TQString::replace() to preprocess text - before inserting it.) If \c RemoveSelected is set, any selected - text (in selection 0) is removed before the text is inserted. - - The default flags are \c CheckNewLines | \c RemoveSelected. - - If the widget is in \c LogText mode this function will do nothing. - - \sa paste() pasteSubType() -*/ - - -void TQTextEdit::insert( const TQString &text, uint insertionFlags ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return; -#endif - - if ( cursor->nestedDepth() != 0 ) // #### for 3.0, disable editing of tables as this is not advanced enough - return; - - bool indent = insertionFlags & RedoIndentation; - bool checkNewLine = insertionFlags & CheckNewLines; - bool removeSelected = insertionFlags & RemoveSelected; - bool imComposition = insertionFlags & AsIMCompositionText; - bool imSelection = insertionFlags & WithIMSelection; - TQString txt( text ); - drawCursor( FALSE ); - if ( !isReadOnly() && doc->hasSelection( TQTextDocument::Standard ) && removeSelected ) - removeSelectedText(); - TQTextCursor c2 = *cursor; - int oldLen = 0; - - if ( undoEnabled && !isReadOnly() && undoRedoInfo.type != UndoRedoInfo::IME ) { - checkUndoRedoInfo( UndoRedoInfo::Insert ); - - if (undoRedoInfo.valid() && undoRedoInfo.index + undoRedoInfo.d->text.length() != cursor->index()) { - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Insert; - } - - if ( !undoRedoInfo.valid() ) { - undoRedoInfo.id = cursor->paragraph()->paragId(); - undoRedoInfo.index = cursor->index(); - undoRedoInfo.d->text = TQString::null; - } - oldLen = undoRedoInfo.d->text.length(); - } - - lastFormatted = checkNewLine && cursor->paragraph()->prev() ? - cursor->paragraph()->prev() : cursor->paragraph(); - TQTextCursor oldCursor = *cursor; - cursor->insert( txt, checkNewLine ); - if ( doc->useFormatCollection() && !doc->preProcessor() ) { - doc->setSelectionStart( TQTextDocument::Temp, oldCursor ); - doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); - doc->setFormat( TQTextDocument::Temp, currentFormat, TQTextFormat::Format ); - doc->removeSelection( TQTextDocument::Temp ); - } - - if ( indent && ( txt == "{" || txt == "}" || txt == ":" || txt == "#" ) ) - cursor->indent(); - formatMore(); - repaintChanged(); - ensureCursorVisible(); - // Asian users regard selection text as cursor on candidate - // selection phase of input method, so ordinary cursor should be - // invisible if IM selection text exists. - drawCursor( !imSelection ); - - if ( undoEnabled && !isReadOnly() && undoRedoInfo.type != UndoRedoInfo::IME ) { - undoRedoInfo.d->text += txt; - if ( !doc->preProcessor() ) { - for ( int i = 0; i < (int)txt.length(); ++i ) { - if ( txt[ i ] != '\n' && c2.paragraph()->at( c2.index() )->format() ) { - c2.paragraph()->at( c2.index() )->format()->addRef(); - undoRedoInfo.d->text. - setFormat( oldLen + i, - c2.paragraph()->at( c2.index() )->format(), TRUE ); - } - c2.gotoNextLetter(); - } - } - } - - if ( !removeSelected ) { - doc->setSelectionStart( TQTextDocument::Standard, oldCursor ); - doc->setSelectionEnd( TQTextDocument::Standard, *cursor ); - repaintChanged(); - } - // updateMicroFocusHint() should not be invoked here when this - // function is invoked from imComposeEvent() because cursor - // postion is incorrect yet. imComposeEvent() invokes - // updateMicroFocusHint() later. - if ( !imComposition ) { - updateMicroFocusHint(); - } - setModified(); - emit textChanged(); -} - -/*! - Inserts \a text in the paragraph \a para at position \a index. -*/ - -void TQTextEdit::insertAt( const TQString &text, int para, int index ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimInsert( text, para, index ); - return; - } -#endif - resetInputContext(); - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return; - removeSelection( TQTextDocument::Standard ); - TQTextCursor tmp = *cursor; - cursor->setParagraph( p ); - cursor->setIndex( index ); - insert( text, FALSE, TRUE, FALSE ); - *cursor = tmp; - removeSelection( TQTextDocument::Standard ); -} - -/*! - Inserts \a text as a new paragraph at position \a para. If \a para - is -1, the text is appended. Use append() if the append operation - is performance critical. -*/ - -void TQTextEdit::insertParagraph( const TQString &text, int para ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimInsert( text + "\n", para, 0 ); - return; - } -#endif - resetInputContext(); - for ( int i = 0; i < (int)doc->numSelections(); ++i ) - doc->removeSelection( i ); - - TQTextParagraph *p = doc->paragAt( para ); - - bool append = !p; - if ( !p ) - p = doc->lastParagraph(); - - TQTextCursor old = *cursor; - drawCursor( FALSE ); - - cursor->setParagraph( p ); - cursor->setIndex( 0 ); - clearUndoRedo(); - qtextedit_ignore_readonly = TRUE; - if ( append && cursor->paragraph()->length() > 1 ) { - cursor->setIndex( cursor->paragraph()->length() - 1 ); - doKeyboardAction( ActionReturn ); - } - insert( text, FALSE, TRUE, TRUE ); - doKeyboardAction( ActionReturn ); - qtextedit_ignore_readonly = FALSE; - - drawCursor( FALSE ); - *cursor = old; - drawCursor( TRUE ); - - repaintChanged(); -} - -/*! - Removes the paragraph \a para. -*/ - -void TQTextEdit::removeParagraph( int para ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return; -#endif - resetInputContext(); - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return; - - for ( int i = 0; i < doc->numSelections(); ++i ) - doc->removeSelection( i ); - - TQTextCursor start( doc ); - TQTextCursor end( doc ); - start.setParagraph( p ); - start.setIndex( 0 ); - end.setParagraph( p ); - end.setIndex( p->length() - 1 ); - - if ( !(p == doc->firstParagraph() && p == doc->lastParagraph()) ) { - if ( p->next() ) { - end.setParagraph( p->next() ); - end.setIndex( 0 ); - } else if ( p->prev() ) { - start.setParagraph( p->prev() ); - start.setIndex( p->prev()->length() - 1 ); - } - } - - doc->setSelectionStart( TQTextDocument::Temp, start ); - doc->setSelectionEnd( TQTextDocument::Temp, end ); - removeSelectedText( TQTextDocument::Temp ); -} - -/*! - Undoes the last operation. - - If there is no operation to undo, i.e. there is no undo step in - the undo/redo history, nothing happens. - - \sa undoAvailable() redo() undoDepth() -*/ - -void TQTextEdit::undo() -{ - clearUndoRedo(); - if ( isReadOnly() || !doc->commands()->isUndoAvailable() || !undoEnabled ) - return; - - resetInputContext(); - for ( int i = 0; i < (int)doc->numSelections(); ++i ) - doc->removeSelection( i ); - -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - - clearUndoRedo(); - drawCursor( FALSE ); - TQTextCursor *c = doc->undo( cursor ); - if ( !c ) { - drawCursor( TRUE ); - return; - } - lastFormatted = 0; - repaintChanged(); - ensureCursorVisible(); - drawCursor( TRUE ); - updateMicroFocusHint(); - setModified(); - // ### If we get back to a completely blank textedit, it - // is possible that cursor is invalid and further actions - // might not fix the problem, so reset the cursor here. - // This is copied from removeSeletedText(), it might be - // okay to just call that. - if ( !cursor->isValid() ) { - delete cursor; - cursor = new TQTextCursor( doc ); - drawCursor( TRUE ); - repaintContents( TRUE ); - } - emit undoAvailable( isUndoAvailable() ); - emit redoAvailable( isRedoAvailable() ); - emit textChanged(); -} - -/*! - Redoes the last operation. - - If there is no operation to redo, i.e. there is no redo step in - the undo/redo history, nothing happens. - - \sa redoAvailable() undo() undoDepth() -*/ - -void TQTextEdit::redo() -{ - if ( isReadOnly() || !doc->commands()->isRedoAvailable() || !undoEnabled ) - return; - - resetInputContext(); - for ( int i = 0; i < (int)doc->numSelections(); ++i ) - doc->removeSelection( i ); - -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - - clearUndoRedo(); - drawCursor( FALSE ); - TQTextCursor *c = doc->redo( cursor ); - if ( !c ) { - drawCursor( TRUE ); - return; - } - lastFormatted = 0; - ensureCursorVisible(); - repaintChanged(); - ensureCursorVisible(); - drawCursor( TRUE ); - updateMicroFocusHint(); - setModified(); - emit undoAvailable( isUndoAvailable() ); - emit redoAvailable( isRedoAvailable() ); - emit textChanged(); -} - -/*! - Pastes the text from the clipboard into the text edit at the - current cursor position. Only plain text is pasted. - - If there is no text in the clipboard nothing happens. - - \sa pasteSubType() cut() TQTextEdit::copy() -*/ - -void TQTextEdit::paste() -{ -#ifndef TQT_NO_MIMECLIPBOARD - if ( isReadOnly() ) - return; - TQString subType = "plain"; - if ( textFormat() != PlainText ) { - TQMimeSource *m = TQApplication::clipboard()->data( d->clipboard_mode ); - if ( !m ) - return; - if ( m->provides( "application/x-qrichtext" ) ) - subType = "x-qrichtext"; - } - - pasteSubType( subType.latin1() ); - updateMicroFocusHint(); -#endif -} - -void TQTextEdit::checkUndoRedoInfo( UndoRedoInfo::Type t ) -{ - if ( undoRedoInfo.valid() && t != undoRedoInfo.type ) { - clearUndoRedo(); - } - undoRedoInfo.type = t; -} - -/*! - Repaints any paragraphs that have changed. - - Although used extensively internally you shouldn't need to call - this yourself. -*/ - -void TQTextEdit::repaintChanged() -{ - if ( !isUpdatesEnabled() || !viewport()->isUpdatesEnabled() ) - return; - - TQPainter p( viewport() ); -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimDrawContents( &p, contentsX(), contentsY(), visibleWidth(), visibleHeight() ); - return; - } -#endif - p.translate( -contentsX(), -contentsY() ); - paintDocument( FALSE, &p, contentsX(), contentsY(), visibleWidth(), visibleHeight() ); -} - -#ifndef TQT_NO_MIME -TQTextDrag *TQTextEdit::dragObject( TQWidget *parent ) const -{ - if ( !doc->hasSelection( TQTextDocument::Standard ) || - doc->selectedText( TQTextDocument::Standard ).isEmpty() ) - return 0; - if ( textFormat() != RichText ) - return new TQTextDrag( doc->selectedText( TQTextDocument::Standard ), parent ); - TQRichTextDrag *drag = new TQRichTextDrag( parent ); - drag->setPlainText( doc->selectedText( TQTextDocument::Standard ) ); - drag->setRichText( doc->selectedText( TQTextDocument::Standard, TRUE ) ); - return drag; -} -#endif - -/*! - Copies the selected text (from selection 0) to the clipboard and - deletes it from the text edit. - - If there is no selected text (in selection 0) nothing happens. - - \sa TQTextEdit::copy() paste() pasteSubType() -*/ - -void TQTextEdit::cut() -{ - if ( isReadOnly() ) - return; - resetInputContext(); - normalCopy(); - removeSelectedText(); - updateMicroFocusHint(); -} - -void TQTextEdit::normalCopy() -{ -#ifndef TQT_NO_MIME - TQTextDrag *drag = dragObject(); - if ( !drag ) - return; -#ifndef TQT_NO_MIMECLIPBOARD - TQApplication::clipboard()->setData( drag, d->clipboard_mode ); -#endif // TQT_NO_MIMECLIPBOARD -#endif // TQT_NO_MIME -} - -/*! - Copies any selected text (from selection 0) to the clipboard. - - \sa hasSelectedText() copyAvailable() -*/ - -void TQTextEdit::copy() -{ -#ifndef TQT_NO_CLIPBOARD -# ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode && optimHasSelection() ) - TQApplication::clipboard()->setText( optimSelectedText(), d->clipboard_mode ); - else - normalCopy(); -# else - normalCopy(); -# endif -#endif -} - -/*! - \internal - - Re-indents the current paragraph. -*/ - -void TQTextEdit::indent() -{ - if ( isReadOnly() ) - return; - - drawCursor( FALSE ); - if ( !doc->hasSelection( TQTextDocument::Standard ) ) - cursor->indent(); - else - doc->indentSelection( TQTextDocument::Standard ); - repaintChanged(); - drawCursor( TRUE ); - setModified(); - emit textChanged(); -} - -/*! - Reimplemented to allow tabbing through links. If \a n is TRUE the - tab moves the focus to the next child; if \a n is FALSE the tab - moves the focus to the previous child. Returns TRUE if the focus - was moved; otherwise returns FALSE. - */ - -bool TQTextEdit::focusNextPrevChild( bool n ) -{ - if ( !isReadOnly() || !linksEnabled() ) - return FALSE; - bool b = doc->focusNextPrevChild( n ); - repaintChanged(); - if ( b ) { - TQTextParagraph *p = doc->focusIndicator.parag; - int start = doc->focusIndicator.start; - int len = doc->focusIndicator.len; - - int y = p->rect().y(); - while ( p - && len == 0 - && p->at( start )->isCustom() - && p->at( start )->customItem()->isNested() ) { - - TQTextTable *t = (TQTextTable*)p->at( start )->customItem(); - TQPtrList<TQTextTableCell> cells = t->tableCells(); - TQTextTableCell *c; - for ( c = cells.first(); c; c = cells.next() ) { - TQTextDocument *cellDoc = c->richText(); - if ( cellDoc->hasFocusParagraph() ) { - y += c->geometry().y() + c->verticalAlignmentOffset(); - - p = cellDoc->focusIndicator.parag; - start = cellDoc->focusIndicator.start; - len = cellDoc->focusIndicator.len; - if ( p ) - y += p->rect().y(); - - break; - } - } - } - setContentsPos( contentsX(), TQMIN( y, contentsHeight() - visibleHeight() ) ); - } - return b; -} - -/*! - \internal - - This functions sets the current format to \a f. Only the fields of \a - f which are specified by the \a flags are used. -*/ - -void TQTextEdit::setFormat( TQTextFormat *f, int flags ) -{ - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - drawCursor( FALSE ); - TQTextCursor c1 = doc->selectionStartCursor( TQTextDocument::Standard ); - c1.restoreState(); - TQTextCursor c2 = doc->selectionEndCursor( TQTextDocument::Standard ); - c2.restoreState(); - if ( undoEnabled ) { - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Format; - undoRedoInfo.id = c1.paragraph()->paragId(); - undoRedoInfo.index = c1.index(); - undoRedoInfo.eid = c2.paragraph()->paragId(); - undoRedoInfo.eindex = c2.index(); - readFormats( c1, c2, undoRedoInfo.d->text ); - undoRedoInfo.format = f; - undoRedoInfo.flags = flags; - clearUndoRedo(); - } - doc->setFormat( TQTextDocument::Standard, f, flags ); - repaintChanged(); - formatMore(); - drawCursor( TRUE ); - setModified(); - emit textChanged(); - } - if ( currentFormat && currentFormat->key() != f->key() ) { - currentFormat->removeRef(); - currentFormat = doc->formatCollection()->format( f ); - if ( currentFormat->isMisspelled() ) { - currentFormat->removeRef(); - currentFormat = doc->formatCollection()->format( currentFormat->font(), - currentFormat->color() ); - } - emit currentFontChanged( currentFormat->font() ); - emit currentColorChanged( currentFormat->color() ); - emit currentVerticalAlignmentChanged( (VerticalAlignment)currentFormat->vAlign() ); - if ( cursor->index() == cursor->paragraph()->length() - 1 ) { - currentFormat->addRef(); - cursor->paragraph()->string()->setFormat( cursor->index(), currentFormat, TRUE ); - if ( cursor->paragraph()->length() == 1 ) { - cursor->paragraph()->invalidate( 0 ); - cursor->paragraph()->format(); - repaintChanged(); - } - } - } -} - -/*! - \reimp -*/ - -void TQTextEdit::setPalette( const TQPalette &p ) -{ - TQScrollView::setPalette( p ); - if ( textFormat() == PlainText ) { - TQTextFormat *f = doc->formatCollection()->defaultFormat(); - f->setColor( colorGroup().text() ); - updateContents(); - } -} - -/*! \internal - \warning In TQt 3.1 we will provide a cleaer API for the - functionality which is provided by this function and in TQt 4.0 this - function will go away. - - Sets the paragraph style of the current paragraph - to \a dm. If \a dm is TQStyleSheetItem::DisplayListItem, the - type of the list item is set to \a listStyle. - - \sa setAlignment() -*/ - -void TQTextEdit::setParagType( TQStyleSheetItem::DisplayMode dm, - TQStyleSheetItem::ListStyle listStyle ) -{ - if ( isReadOnly() ) - return; - - drawCursor( FALSE ); - TQTextParagraph *start = cursor->paragraph(); - TQTextParagraph *end = start; - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - start = doc->selectionStartCursor( TQTextDocument::Standard ).topParagraph(); - end = doc->selectionEndCursor( TQTextDocument::Standard ).topParagraph(); - if ( end->paragId() < start->paragId() ) - return; // do not trust our selections - } - - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Style; - undoRedoInfo.id = start->paragId(); - undoRedoInfo.eid = end->paragId(); - undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); - - while ( start != end->next() ) { - start->setListStyle( listStyle ); - if ( dm == TQStyleSheetItem::DisplayListItem ) { - start->setListItem( TRUE ); - if( start->listDepth() == 0 ) - start->setListDepth( 1 ); - } else if ( start->isListItem() ) { - start->setListItem( FALSE ); - start->setListDepth( TQMAX( start->listDepth()-1, 0 ) ); - } - start = start->next(); - } - - clearUndoRedo(); - repaintChanged(); - formatMore(); - drawCursor( TRUE ); - setModified(); - emit textChanged(); -} - -/*! - Sets the alignment of the current paragraph to \a a. Valid - alignments are \c TQt::AlignLeft, \c TQt::AlignRight, - \c TQt::AlignJustify and \c TQt::AlignCenter (which centers - horizontally). -*/ - -void TQTextEdit::setAlignment( int a ) -{ - if ( isReadOnly() || block_set_alignment ) - return; - - drawCursor( FALSE ); - TQTextParagraph *start = cursor->paragraph(); - TQTextParagraph *end = start; - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - start = doc->selectionStartCursor( TQTextDocument::Standard ).topParagraph(); - end = doc->selectionEndCursor( TQTextDocument::Standard ).topParagraph(); - if ( end->paragId() < start->paragId() ) - return; // do not trust our selections - } - - clearUndoRedo(); - undoRedoInfo.type = UndoRedoInfo::Style; - undoRedoInfo.id = start->paragId(); - undoRedoInfo.eid = end->paragId(); - undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); - - while ( start != end->next() ) { - start->setAlignment( a ); - start = start->next(); - } - - clearUndoRedo(); - repaintChanged(); - formatMore(); - drawCursor( TRUE ); - if ( currentAlignment != a ) { - currentAlignment = a; - emit currentAlignmentChanged( currentAlignment ); - } - setModified(); - emit textChanged(); -} - -void TQTextEdit::updateCurrentFormat() -{ - int i = cursor->index(); - if ( i > 0 ) - --i; - if ( doc->useFormatCollection() && - ( !currentFormat || currentFormat->key() != cursor->paragraph()->at( i )->format()->key() ) ) { - if ( currentFormat ) - currentFormat->removeRef(); - currentFormat = doc->formatCollection()->format( cursor->paragraph()->at( i )->format() ); - if ( currentFormat->isMisspelled() ) { - currentFormat->removeRef(); - currentFormat = doc->formatCollection()->format( currentFormat->font(), currentFormat->color() ); - } - emit currentFontChanged( currentFormat->font() ); - emit currentColorChanged( currentFormat->color() ); - emit currentVerticalAlignmentChanged( (VerticalAlignment)currentFormat->vAlign() ); - } - - if ( currentAlignment != cursor->paragraph()->alignment() ) { - currentAlignment = cursor->paragraph()->alignment(); - block_set_alignment = TRUE; - emit currentAlignmentChanged( currentAlignment ); - block_set_alignment = FALSE; - } -} - -/*! - If \a b is TRUE sets the current format to italic; otherwise sets - the current format to non-italic. - - \sa italic() -*/ - -void TQTextEdit::setItalic( bool b ) -{ - TQTextFormat f( *currentFormat ); - f.setItalic( b ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat(f2, TQTextFormat::Italic ); -} - -/*! - If \a b is TRUE sets the current format to bold; otherwise sets - the current format to non-bold. - - \sa bold() -*/ - -void TQTextEdit::setBold( bool b ) -{ - TQTextFormat f( *currentFormat ); - f.setBold( b ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::Bold ); -} - -/*! - If \a b is TRUE sets the current format to underline; otherwise - sets the current format to non-underline. - - \sa underline() -*/ - -void TQTextEdit::setUnderline( bool b ) -{ - TQTextFormat f( *currentFormat ); - f.setUnderline( b ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::Underline ); -} - -/*! - Sets the font family of the current format to \a fontFamily. - - \sa family() setCurrentFont() -*/ - -void TQTextEdit::setFamily( const TQString &fontFamily ) -{ - TQTextFormat f( *currentFormat ); - f.setFamily( fontFamily ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::Family ); -} - -/*! - Sets the point size of the current format to \a s. - - Note that if \a s is zero or negative, the behaviour of this - function is not defined. - - \sa pointSize() setCurrentFont() setFamily() -*/ - -void TQTextEdit::setPointSize( int s ) -{ - TQTextFormat f( *currentFormat ); - f.setPointSize( s ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::Size ); -} - -/*! - Sets the color of the current format, i.e. of the text, to \a c. - - \sa color() setPaper() -*/ - -void TQTextEdit::setColor( const TQColor &c ) -{ - TQTextFormat f( *currentFormat ); - f.setColor( c ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::Color ); -} - -/*! - Sets the vertical alignment of the current format, i.e. of the - text, to \a a. - - \sa color() setPaper() -*/ - -void TQTextEdit::setVerticalAlignment( VerticalAlignment a ) -{ - TQTextFormat f( *currentFormat ); - f.setVAlign( (TQTextFormat::VerticalAlignment)a ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::VAlign ); -} - -void TQTextEdit::setFontInternal( const TQFont &f_ ) -{ - TQTextFormat f( *currentFormat ); - f.setFont( f_ ); - TQTextFormat *f2 = doc->formatCollection()->format( &f ); - setFormat( f2, TQTextFormat::Font ); -} - - -TQString TQTextEdit::text() const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return optimText(); -#endif - - TQTextParagraph *p = doc->firstParagraph(); - if ( !p || (!p->next() && p->length() <= 1) ) - return TQString::fromLatin1(""); - - if ( isReadOnly() ) - return doc->originalText(); - return doc->text(); -} - -/*! - \overload - - Returns the text of paragraph \a para. - - If textFormat() is \c RichText the text will contain HTML - formatting tags. -*/ - -TQString TQTextEdit::text( int para ) const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode && (d->od->numLines >= para) ) { - TQString paraStr = d->od->lines[ LOGOFFSET(para) ]; - if ( paraStr.isEmpty() ) - paraStr = "\n"; - return paraStr; - } else -#endif - return doc->text( para ); -} - -/*! - \overload - - Changes the text of the text edit to the string \a text and the - context to \a context. Any previous text is removed. - - \a text may be interpreted either as plain text or as rich text, - depending on the textFormat(). The default setting is \c AutoText, - i.e. the text edit auto-detects the format from \a text. - - For rich text the rendering style and available tags are defined - by a styleSheet(); see TQStyleSheet for details. - - The optional \a context is a path which the text edit's - TQMimeSourceFactory uses to resolve the locations of files and - images. (See \l{TQTextEdit::TQTextEdit()}.) It is passed to the text - edit's TQMimeSourceFactory when quering data. - - Note that the undo/redo history is cleared by this function. - - \sa text(), setTextFormat() -*/ - -void TQTextEdit::setText( const TQString &text, const TQString &context ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimSetText( text ); - return; - } -#endif - resetInputContext(); - if ( !isModified() && isReadOnly() && - this->context() == context && this->text() == text ) - return; - - emit undoAvailable( FALSE ); - emit redoAvailable( FALSE ); - undoRedoInfo.clear(); - doc->commands()->clear(); - - lastFormatted = 0; - int oldCursorPos = cursor->index(); - int oldCursorPar = cursor->paragraph()->paragId(); - cursor->restoreState(); - delete cursor; - doc->setText( text, context ); - - if ( wrapMode == FixedPixelWidth ) { - resizeContents( wrapWidth, 0 ); - doc->setWidth( wrapWidth ); - doc->setMinimumWidth( wrapWidth ); - } else { - doc->setMinimumWidth( -1 ); - resizeContents( 0, 0 ); - } - - lastFormatted = doc->firstParagraph(); - cursor = new TQTextCursor( doc ); - updateContents(); - - if ( isModified() ) - setModified( FALSE ); - emit textChanged(); - if ( cursor->index() != oldCursorPos || cursor->paragraph()->paragId() != oldCursorPar ) { - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); - } - formatMore(); - updateCurrentFormat(); - d->scrollToAnchor = TQString::null; -} - -/*! - \property TQTextEdit::text - \brief the text edit's text - - There is no default text. - - On setting, any previous text is deleted. - - The text may be interpreted either as plain text or as rich text, - depending on the textFormat(). The default setting is \c AutoText, - i.e. the text edit auto-detects the format of the text. - - For richtext, calling text() on an editable TQTextEdit will cause - the text to be regenerated from the textedit. This may mean that - the TQString returned may not be exactly the same as the one that - was set. - - \sa textFormat -*/ - - -/*! - \property TQTextEdit::readOnly - \brief whether the text edit is read-only - - In a read-only text edit the user can only navigate through the - text and select text; modifying the text is not possible. - - This property's default is FALSE. -*/ - -/*! - Finds the next occurrence of the string, \a expr. Returns TRUE if - \a expr was found; otherwise returns FALSE. - - If \a para and \a index are both 0 the search begins from the - current cursor position. If \a para and \a index are both not 0, - the search begins from the \a *index character position in the - \a *para paragraph. - - If \a cs is TRUE the search is case sensitive, otherwise it is - case insensitive. If \a wo is TRUE the search looks for whole word - matches only; otherwise it searches for any matching text. If \a - forward is TRUE (the default) the search works forward from the - starting position to the end of the text, otherwise it works - backwards to the beginning of the text. - - If \a expr is found the function returns TRUE. If \a index and \a - para are not 0, the number of the paragraph in which the first - character of the match was found is put into \a *para, and the - index position of that character within the paragraph is put into - \a *index. - - If \a expr is not found the function returns FALSE. If \a index - and \a para are not 0 and \a expr is not found, \a *index - and \a *para are undefined. - - Please note that this function will make the next occurrence of - the string (if found) the current selection, and will thus - modify the cursor position. - - Using the \a para and \a index parameters will not work correctly - in case the document contains tables. -*/ - -bool TQTextEdit::find( const TQString &expr, bool cs, bool wo, bool forward, - int *para, int *index ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return optimFind( expr, cs, wo, forward, para, index ); -#endif - drawCursor( FALSE ); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - TQTextCursor findcur = *cursor; - if ( para && index ) { - if ( doc->paragAt( *para ) ) - findcur.gotoPosition( doc->paragAt(*para), *index ); - else - findcur.gotoEnd(); - } else if ( doc->hasSelection( TQTextDocument::Standard ) ){ - // maks sure we do not find the same selection again - if ( forward ) - findcur.gotoNextLetter(); - else - findcur.gotoPreviousLetter(); - } else if (!forward && findcur.index() == 0 && findcur.paragraph() == findcur.topParagraph()) { - findcur.gotoEnd(); - } - removeSelection( TQTextDocument::Standard ); - bool found = doc->find( findcur, expr, cs, wo, forward ); - if ( found ) { - if ( para ) - *para = findcur.paragraph()->paragId(); - if ( index ) - *index = findcur.index(); - *cursor = findcur; - repaintChanged(); - ensureCursorVisible(); - } - drawCursor( TRUE ); - if (found) { - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); - } - return found; -} - -void TQTextEdit::blinkCursor() -{ - if ( !cursorVisible ) - return; - bool cv = cursorVisible; - blinkCursorVisible = !blinkCursorVisible; - drawCursor( blinkCursorVisible ); - cursorVisible = cv; -} - -/*! - Sets the cursor to position \a index in paragraph \a para. - - \sa getCursorPosition() -*/ - -void TQTextEdit::setCursorPosition( int para, int index ) -{ - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return; - - resetInputContext(); - if ( index > p->length() - 1 ) - index = p->length() - 1; - - drawCursor( FALSE ); - cursor->setParagraph( p ); - cursor->setIndex( index ); - ensureCursorVisible(); - drawCursor( TRUE ); - updateCurrentFormat(); - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); -} - -/*! - This function sets the \a *para and \a *index parameters to the - current cursor position. \a para and \a index must not be 0. - - \sa setCursorPosition() -*/ - -void TQTextEdit::getCursorPosition( int *para, int *index ) const -{ - if ( !para || !index ) - return; - *para = cursor->paragraph()->paragId(); - *index = cursor->index(); -} - -/*! - Sets a selection which starts at position \a indexFrom in - paragraph \a paraFrom and ends at position \a indexTo in paragraph - \a paraTo. - - Any existing selections which have a different id (\a selNum) are - left alone, but if an existing selection has the same id as \a - selNum it is removed and replaced by this selection. - - Uses the selection settings of selection \a selNum. If \a selNum - is 0, this is the default selection. - - The cursor is moved to the end of the selection if \a selNum is 0, - otherwise the cursor position remains unchanged. - - \sa getSelection() selectedText -*/ - -void TQTextEdit::setSelection( int paraFrom, int indexFrom, - int paraTo, int indexTo, int selNum ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if (d->optimMode) { - optimSetSelection(paraFrom, indexFrom, paraTo, indexTo); - repaintContents(FALSE); - return; - } -#endif - resetInputContext(); - if ( doc->hasSelection( selNum ) ) { - doc->removeSelection( selNum ); - repaintChanged(); - } - if ( selNum > doc->numSelections() - 1 ) - doc->addSelection( selNum ); - TQTextParagraph *p1 = doc->paragAt( paraFrom ); - if ( !p1 ) - return; - TQTextParagraph *p2 = doc->paragAt( paraTo ); - if ( !p2 ) - return; - - if ( indexFrom > p1->length() - 1 ) - indexFrom = p1->length() - 1; - if ( indexTo > p2->length() - 1 ) - indexTo = p2->length() - 1; - - drawCursor( FALSE ); - TQTextCursor c = *cursor; - TQTextCursor oldCursor = *cursor; - c.setParagraph( p1 ); - c.setIndex( indexFrom ); - cursor->setParagraph( p2 ); - cursor->setIndex( indexTo ); - doc->setSelectionStart( selNum, c ); - doc->setSelectionEnd( selNum, *cursor ); - repaintChanged(); - ensureCursorVisible(); - if ( selNum != TQTextDocument::Standard ) - *cursor = oldCursor; - drawCursor( TRUE ); -} - -/*! - If there is a selection, \a *paraFrom is set to the number of the - paragraph in which the selection begins and \a *paraTo is set to - the number of the paragraph in which the selection ends. (They - could be the same.) \a *indexFrom is set to the index at which the - selection begins within \a *paraFrom, and \a *indexTo is set to - the index at which the selection ends within \a *paraTo. - - If there is no selection, \a *paraFrom, \a *indexFrom, \a *paraTo - and \a *indexTo are all set to -1. - - If \a paraFrom, \a indexFrom, \a paraTo or \a indexTo is 0 this - function does nothing. - - The \a selNum is the number of the selection (multiple selections - are supported). It defaults to 0 (the default selection). - - \sa setSelection() selectedText -*/ - -void TQTextEdit::getSelection( int *paraFrom, int *indexFrom, - int *paraTo, int *indexTo, int selNum ) const -{ - if ( !paraFrom || !paraTo || !indexFrom || !indexTo ) - return; -#ifdef QT_TEXTEDIT_OPTIMIZATION - if (d->optimMode) { - *paraFrom = d->od->selStart.line; - *paraTo = d->od->selEnd.line; - *indexFrom = d->od->selStart.index; - *indexTo = d->od->selEnd.index; - return; - } -#endif - if ( !doc->hasSelection( selNum ) ) { - *paraFrom = -1; - *indexFrom = -1; - *paraTo = -1; - *indexTo = -1; - return; - } - - doc->selectionStart( selNum, *paraFrom, *indexFrom ); - doc->selectionEnd( selNum, *paraTo, *indexTo ); -} - -/*! - \property TQTextEdit::textFormat - \brief the text format: rich text, plain text, log text or auto text. - - The text format is one of the following: - \list - \i PlainText - all characters, except newlines, are displayed - verbatim, including spaces. Whenever a newline appears in the text - the text edit inserts a hard line break and begins a new - paragraph. - \i RichText - rich text rendering. The available styles are - defined in the default stylesheet TQStyleSheet::defaultSheet(). - \i LogText - optimized mode for very large texts. Supports a very - limited set of formatting tags (color, bold, underline and italic - settings). - \i AutoText - this is the default. The text edit autodetects which - rendering style is best, \c PlainText or \c RichText. This is done - by using the TQStyleSheet::mightBeRichText() function. - \endlist -*/ - -void TQTextEdit::setTextFormat( TextFormat format ) -{ - doc->setTextFormat( format ); -#ifdef QT_TEXTEDIT_OPTIMIZATION - checkOptimMode(); -#endif -} - -TQt::TextFormat TQTextEdit::textFormat() const -{ - return doc->textFormat(); -} - -/*! - Returns the number of paragraphs in the text; an empty textedit is always - considered to have one paragraph, so 1 is returned in this case. -*/ - -int TQTextEdit::paragraphs() const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - return d->od->numLines; - } -#endif - return doc->lastParagraph()->paragId() + 1; -} - -/*! - Returns the number of lines in paragraph \a para, or -1 if there - is no paragraph with index \a para. -*/ - -int TQTextEdit::linesOfParagraph( int para ) const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - if ( d->od->numLines >= para ) - return 1; - else - return -1; - } -#endif - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return -1; - return p->lines(); -} - -/*! - Returns the length of the paragraph \a para (i.e. the number of - characters), or -1 if there is no paragraph with index \a para. - - This function ignores newlines. -*/ - -int TQTextEdit::paragraphLength( int para ) const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - if ( d->od->numLines >= para ) { - if ( d->od->lines[ LOGOFFSET(para) ].isEmpty() ) // CR - return 1; - else - return d->od->lines[ LOGOFFSET(para) ].length(); - } - return -1; - } -#endif - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return -1; - return p->length() - 1; -} - -/*! - Returns the number of lines in the text edit; this could be 0. - - \warning This function may be slow. Lines change all the time - during word wrapping, so this function has to iterate over all the - paragraphs and get the number of lines from each one individually. -*/ - -int TQTextEdit::lines() const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - return d->od->numLines; - } -#endif - TQTextParagraph *p = doc->firstParagraph(); - int l = 0; - while ( p ) { - l += p->lines(); - p = p->next(); - } - - return l; -} - -/*! - Returns the line number of the line in paragraph \a para in which - the character at position \a index appears. The \a index position is - relative to the beginning of the paragraph. If there is no such - paragraph or no such character at the \a index position (e.g. the - index is out of range) -1 is returned. -*/ - -int TQTextEdit::lineOfChar( int para, int index ) -{ - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return -1; - - int idx, line; - TQTextStringChar *c = p->lineStartOfChar( index, &idx, &line ); - if ( !c ) - return -1; - - return line; -} - -void TQTextEdit::setModified( bool m ) -{ - bool oldModified = modified; - modified = m; - if ( modified && doc->oTextValid ) - doc->invalidateOriginalText(); - if ( oldModified != modified ) - emit modificationChanged( modified ); -} - -/*! - \property TQTextEdit::modified - \brief whether the document has been modified by the user -*/ - -bool TQTextEdit::isModified() const -{ - return modified; -} - -void TQTextEdit::setModified() -{ - if ( !isModified() ) - setModified( TRUE ); -} - -/*! - Returns TRUE if the current format is italic; otherwise returns FALSE. - - \sa setItalic() -*/ - -bool TQTextEdit::italic() const -{ - return currentFormat->font().italic(); -} - -/*! - Returns TRUE if the current format is bold; otherwise returns FALSE. - - \sa setBold() -*/ - -bool TQTextEdit::bold() const -{ - return currentFormat->font().bold(); -} - -/*! - Returns TRUE if the current format is underlined; otherwise returns - FALSE. - - \sa setUnderline() -*/ - -bool TQTextEdit::underline() const -{ - return currentFormat->font().underline(); -} - -/*! - Returns the font family of the current format. - - \sa setFamily() setCurrentFont() setPointSize() -*/ - -TQString TQTextEdit::family() const -{ - return currentFormat->font().family(); -} - -/*! - Returns the point size of the font of the current format. - - \sa setFamily() setCurrentFont() setPointSize() -*/ - -int TQTextEdit::pointSize() const -{ - return currentFormat->font().pointSize(); -} - -/*! - Returns the color of the current format. - - \sa setColor() setPaper() -*/ - -TQColor TQTextEdit::color() const -{ - return currentFormat->color(); -} - -/*! - \obsolete - - Returns TQScrollView::font() - - \warning In previous versions this function returned the font of - the current format. This lead to confusion. Please use - currentFont() instead. -*/ - -TQFont TQTextEdit::font() const -{ - return TQScrollView::font(); -} - -/*! - Returns the font of the current format. - - \sa setCurrentFont() setFamily() setPointSize() -*/ - -TQFont TQTextEdit::currentFont() const -{ - return currentFormat->font(); -} - - -/*! - Returns the alignment of the current paragraph. - - \sa setAlignment() -*/ - -int TQTextEdit::alignment() const -{ - return currentAlignment; -} - -void TQTextEdit::startDrag() -{ -#ifndef TQT_NO_DRAGANDDROP - mousePressed = FALSE; - inDoubleClick = FALSE; - TQDragObject *drag = dragObject( viewport() ); - if ( !drag ) - return; - if ( isReadOnly() ) { - drag->dragCopy(); - } else { - if ( drag->drag() && TQDragObject::target() != this && TQDragObject::target() != viewport() ) - removeSelectedText(); - } -#endif -} - -/*! - If \a select is TRUE (the default), all the text is selected as - selection 0. If \a select is FALSE any selected text is - unselected, i.e. the default selection (selection 0) is cleared. - - \sa selectedText -*/ - -void TQTextEdit::selectAll( bool select ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - if ( select ) - optimSelectAll(); - else - optimRemoveSelection(); - return; - } -#endif - if ( !select ) - doc->removeSelection( TQTextDocument::Standard ); - else - doc->selectAll( TQTextDocument::Standard ); - repaintChanged(); - emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); - emit selectionChanged(); -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif -} - -void TQTextEdit::UndoRedoInfo::clear() -{ - if ( valid() ) { - if ( type == Insert || type == Return ) - doc->addCommand( new TQTextInsertCommand( doc, id, index, d->text.rawData(), styleInformation ) ); - else if ( type == Format ) - doc->addCommand( new TQTextFormatCommand( doc, id, index, eid, eindex, d->text.rawData(), format, flags ) ); - else if ( type == Style ) - doc->addCommand( new TQTextStyleCommand( doc, id, eid, styleInformation ) ); - else if ( type != Invalid ) { - doc->addCommand( new TQTextDeleteCommand( doc, id, index, d->text.rawData(), styleInformation ) ); - } - } - type = Invalid; - d->text = TQString::null; - id = -1; - index = -1; - styleInformation = TQByteArray(); -} - - -/*! - If there is some selected text (in selection 0) it is deleted. If - there is no selected text (in selection 0) the character to the - right of the text cursor is deleted. - - \sa removeSelectedText() cut() -*/ - -void TQTextEdit::del() -{ - if ( doc->hasSelection( TQTextDocument::Standard ) ) { - removeSelectedText(); - return; - } - - doKeyboardAction( ActionDelete ); -} - - -TQTextEdit::UndoRedoInfo::UndoRedoInfo( TQTextDocument *dc ) - : type( Invalid ), doc( dc ) -{ - d = new TQUndoRedoInfoPrivate; - d->text = TQString::null; - id = -1; - index = -1; -} - -TQTextEdit::UndoRedoInfo::~UndoRedoInfo() -{ - delete d; -} - -bool TQTextEdit::UndoRedoInfo::valid() const -{ - return id >= 0 && type != Invalid; -} - -/*! - \internal - - Resets the current format to the default format. -*/ - -void TQTextEdit::resetFormat() -{ - setAlignment( TQt::AlignAuto ); - setParagType( TQStyleSheetItem::DisplayBlock, TQStyleSheetItem::ListDisc ); - setFormat( doc->formatCollection()->defaultFormat(), TQTextFormat::Format ); -} - -/*! - Returns the TQStyleSheet which is being used by this text edit. - - \sa setStyleSheet() -*/ - -TQStyleSheet* TQTextEdit::styleSheet() const -{ - return doc->styleSheet(); -} - -/*! - Sets the stylesheet to use with this text edit to \a styleSheet. - Changes will only take effect for new text added with setText() or - append(). - - \sa styleSheet() -*/ - -void TQTextEdit::setStyleSheet( TQStyleSheet* styleSheet ) -{ - doc->setStyleSheet( styleSheet ); -} - -/*! - \property TQTextEdit::paper - \brief the background (paper) brush. - - The brush that is currently used to draw the background of the - text edit. The initial setting is an empty brush. -*/ - -void TQTextEdit::setPaper( const TQBrush& pap ) -{ - doc->setPaper( new TQBrush( pap ) ); - - if ( pap.pixmap() ) { - viewport()->setBackgroundPixmap( *pap.pixmap() ); - } else { - setPaletteBackgroundColor( pap.color() ); - viewport()->setPaletteBackgroundColor( pap.color() ); - } - -#ifdef QT_TEXTEDIT_OPTIMIZATION - // force a repaint of the entire viewport - using updateContents() - // would clip the coords to the content size - if (d->optimMode) - repaintContents(contentsX(), contentsY(), viewport()->width(), viewport()->height()); - else -#endif - updateContents(); -} - -TQBrush TQTextEdit::paper() const -{ - if ( doc->paper() ) - return *doc->paper(); - return TQBrush( colorGroup().base() ); -} - -/*! - \property TQTextEdit::linkUnderline - \brief whether hypertext links will be underlined - - If TRUE (the default) hypertext links will be displayed - underlined. If FALSE links will not be displayed underlined. -*/ - -void TQTextEdit::setLinkUnderline( bool b ) -{ - if ( doc->underlineLinks() == b ) - return; - doc->setUnderlineLinks( b ); - repaintChanged(); -} - -bool TQTextEdit::linkUnderline() const -{ - return doc->underlineLinks(); -} - -/*! - Sets the text edit's mimesource factory to \a factory. See - TQMimeSourceFactory for further details. - - \sa mimeSourceFactory() - */ - -#ifndef TQT_NO_MIME -void TQTextEdit::setMimeSourceFactory( TQMimeSourceFactory* factory ) -{ - doc->setMimeSourceFactory( factory ); -} - -/*! - Returns the TQMimeSourceFactory which is being used by this text - edit. - - \sa setMimeSourceFactory() -*/ - -TQMimeSourceFactory* TQTextEdit::mimeSourceFactory() const -{ - return doc->mimeSourceFactory(); -} -#endif - -/*! - Returns how many pixels high the text edit needs to be to display - all the text if the text edit is \a w pixels wide. -*/ - -int TQTextEdit::heightForWidth( int w ) const -{ - int oldw = doc->width(); - doc->doLayout( 0, w ); - int h = doc->height(); - doc->setWidth( oldw ); - doc->invalidate(); - ( (TQTextEdit*)this )->formatMore(); - return h; -} - -/*! - Appends a new paragraph with \a text to the end of the text edit. Note that - the undo/redo history is cleared by this function, and no undo - history is kept for appends which makes them faster than - insert()s. If you want to append text which is added to the - undo/redo history as well, use insertParagraph(). -*/ - -void TQTextEdit::append( const TQString &text ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimAppend( text ); - return; - } -#endif - // flush and clear the undo/redo stack if necessary - undoRedoInfo.clear(); - doc->commands()->clear(); - - doc->removeSelection( TQTextDocument::Standard ); - TextFormat f = doc->textFormat(); - if ( f == AutoText ) { - if ( TQStyleSheet::mightBeRichText( text ) ) - f = RichText; - else - f = PlainText; - } - - drawCursor( FALSE ); - TQTextCursor oldc( *cursor ); - ensureFormatted( doc->lastParagraph() ); - bool atBottom = contentsY() >= contentsHeight() - visibleHeight(); - cursor->gotoEnd(); - if ( cursor->index() > 0 ) - cursor->splitAndInsertEmptyParagraph(); - TQTextCursor oldCursor2 = *cursor; - - if ( f == TQt::PlainText ) { - cursor->insert( text, TRUE ); - if ( doc->useFormatCollection() && !doc->preProcessor() && - currentFormat != cursor->paragraph()->at( cursor->index() )->format() ) { - doc->setSelectionStart( TQTextDocument::Temp, oldCursor2 ); - doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); - doc->setFormat( TQTextDocument::Temp, currentFormat, TQTextFormat::Format ); - doc->removeSelection( TQTextDocument::Temp ); - } - } else { - cursor->paragraph()->setListItem( FALSE ); - cursor->paragraph()->setListDepth( 0 ); - if ( cursor->paragraph()->prev() ) - cursor->paragraph()->prev()->invalidate(0); // vertical margins might have to change - doc->setRichTextInternal( text ); - } - formatMore(); - repaintChanged(); - if ( atBottom ) - scrollToBottom(); - *cursor = oldc; - if ( !isReadOnly() ) - cursorVisible = TRUE; - setModified(); - emit textChanged(); -} - -/*! - \property TQTextEdit::hasSelectedText - \brief whether some text is selected in selection 0 -*/ - -bool TQTextEdit::hasSelectedText() const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return optimHasSelection(); - else -#endif - return doc->hasSelection( TQTextDocument::Standard ); -} - -/*! - \property TQTextEdit::selectedText - \brief The selected text (from selection 0) or an empty string if - there is no currently selected text (in selection 0). - - The text is always returned as \c PlainText if the textFormat() is - \c PlainText or \c AutoText, otherwise it is returned as HTML. - - \sa hasSelectedText -*/ - -TQString TQTextEdit::selectedText() const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return optimSelectedText(); - else -#endif - return doc->selectedText( TQTextDocument::Standard, textFormat() == RichText ); -} - -bool TQTextEdit::handleReadOnlyKeyEvent( TQKeyEvent *e ) -{ - switch( e->key() ) { - case Key_Down: - setContentsPos( contentsX(), contentsY() + 10 ); - break; - case Key_Up: - setContentsPos( contentsX(), contentsY() - 10 ); - break; - case Key_Left: - setContentsPos( contentsX() - 10, contentsY() ); - break; - case Key_Right: - setContentsPos( contentsX() + 10, contentsY() ); - break; - case Key_PageUp: - setContentsPos( contentsX(), contentsY() - visibleHeight() ); - break; - case Key_PageDown: - setContentsPos( contentsX(), contentsY() + visibleHeight() ); - break; - case Key_Home: - setContentsPos( contentsX(), 0 ); - break; - case Key_End: - setContentsPos( contentsX(), contentsHeight() - visibleHeight() ); - break; - case Key_F16: // Copy key on Sun keyboards - copy(); - break; -#ifndef TQT_NO_NETWORKPROTOCOL - case Key_Return: - case Key_Enter: - case Key_Space: { - if (!doc->focusIndicator.href.isEmpty() - || !doc->focusIndicator.name.isEmpty()) { - if (!doc->focusIndicator.href.isEmpty()) { - TQUrl u( doc->context(), doc->focusIndicator.href, TRUE ); - emitLinkClicked( u.toString( FALSE, FALSE ) ); - } - if (!doc->focusIndicator.name.isEmpty()) { - if (::tqt_cast<TQTextBrowser*>(this)) { // change for 4.0 - TQConnectionList *clist = receivers( - "anchorClicked(const TQString&,const TQString&)"); - if (!signalsBlocked() && clist) { - TQUObject o[3]; - static_QUType_TQString.set(o+1, - doc->focusIndicator.name); - static_QUType_TQString.set(o+2, - doc->focusIndicator.href); - activate_signal( clist, o); - } - } - } -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - } - } break; -#endif - default: - if ( e->state() & ControlButton ) { - switch ( e->key() ) { - case Key_C: case Key_F16: // Copy key on Sun keyboards - copy(); - break; -#ifdef TQ_WS_WIN - case Key_Insert: - copy(); - break; - case Key_A: - selectAll(); - break; -#endif - } - - } - return FALSE; - } - return TRUE; -} - -/*! - Returns the context of the text edit. The context is a path which - the text edit's TQMimeSourceFactory uses to resolve the locations - of files and images. - - \sa text -*/ - -TQString TQTextEdit::context() const -{ - return doc->context(); -} - -/*! - \property TQTextEdit::documentTitle - \brief the title of the document parsed from the text. - - For \c PlainText the title will be an empty string. For \c - RichText the title will be the text between the \c{<title>} tags, - if present, otherwise an empty string. -*/ - -TQString TQTextEdit::documentTitle() const -{ - return doc->attributes()[ "title" ]; -} - -void TQTextEdit::makeParagVisible( TQTextParagraph *p ) -{ - setContentsPos( contentsX(), TQMIN( p->rect().y(), contentsHeight() - visibleHeight() ) ); -} - -/*! - Scrolls the text edit to make the text at the anchor called \a - name visible, if it can be found in the document. If the anchor - isn't found no scrolling will occur. An anchor is defined using - the HTML anchor tag, e.g. \c{<a name="target">}. -*/ - -void TQTextEdit::scrollToAnchor( const TQString& name ) -{ - if ( !isVisible() ) { - d->scrollToAnchor = name; - return; - } - if ( name.isEmpty() ) - return; - sync(); - TQTextCursor cursor( doc ); - TQTextParagraph* last = doc->lastParagraph(); - for (;;) { - TQTextStringChar* c = cursor.paragraph()->at( cursor.index() ); - if( c->isAnchor() ) { - TQString a = c->anchorName(); - if ( a == name || - (a.contains( '#' ) && TQStringList::split( '#', a ).contains( name ) ) ) { - setContentsPos( contentsX(), TQMIN( cursor.paragraph()->rect().top() + cursor.totalOffsetY(), contentsHeight() - visibleHeight() ) ); - break; - } - } - if ( cursor.paragraph() == last && cursor.atParagEnd() ) - break; - cursor.gotoNextLetter(); - } -} - -/*! - \overload - - If there is an anchor at position \a pos (in contents - coordinates), its \c href is returned, otherwise TQString::null is - returned. -*/ - -TQString TQTextEdit::anchorAt( const TQPoint& pos ) -{ - return anchorAt(pos, AnchorHref); -} - -/*! - If there is an anchor at position \a pos (in contents - coordinates), the text for attribute \a attr is returned, - otherwise TQString::null is returned. -*/ - -TQString TQTextEdit::anchorAt( const TQPoint& pos, AnchorAttribute attr ) -{ - TQTextCursor c( doc ); - placeCursor( pos, &c ); - switch(attr) { - case AnchorName: - return c.paragraph()->at( c.index() )->anchorName(); - case AnchorHref: - return c.paragraph()->at( c.index() )->anchorHref(); - } - // incase the compiler is really dumb about determining if a function - // returns something :) - return TQString::null; -} - -void TQTextEdit::documentWidthChanged( int w ) -{ - resizeContents( TQMAX( visibleWidth(), w), contentsHeight() ); -} - -/*! \internal - - This function does nothing -*/ - -void TQTextEdit::updateStyles() -{ -} - -void TQTextEdit::setDocument( TQTextDocument *dc ) -{ - if ( dc == 0 ) { - tqWarning( "Q3TextEdit::setDocument() called with null Q3TextDocument pointer" ); - return; - } - if ( dc == doc ) - return; - resetInputContext(); - doc = dc; - delete cursor; - cursor = new TQTextCursor( doc ); - clearUndoRedo(); - undoRedoInfo.doc = doc; - lastFormatted = 0; -} - -#ifndef TQT_NO_CLIPBOARD - -/*! - Pastes the text with format \a subtype from the clipboard into the - text edit at the current cursor position. The \a subtype can be - "plain" or "html". - - If there is no text with format \a subtype in the clipboard - nothing happens. - - \sa paste() cut() TQTextEdit::copy() -*/ - -void TQTextEdit::pasteSubType( const TQCString &subtype ) -{ -#ifndef TQT_NO_MIMECLIPBOARD - TQMimeSource *m = TQApplication::clipboard()->data( d->clipboard_mode ); - pasteSubType( subtype, m ); -#endif -} - -/*! \internal */ - -void TQTextEdit::pasteSubType( const TQCString& subtype, TQMimeSource *m ) -{ -#ifndef TQT_NO_MIME - TQCString st = subtype; - if ( subtype != "x-qrichtext" ) - st.prepend( "text/" ); - else - st.prepend( "application/" ); - if ( !m ) - return; - if ( doc->hasSelection( TQTextDocument::Standard ) ) - removeSelectedText(); - if ( !TQRichTextDrag::canDecode( m ) ) - return; - TQString t; - if ( !TQRichTextDrag::decode( m, t, st.data(), subtype ) ) - return; - if ( st == "application/x-qrichtext" ) { - int start; - if ( (start = t.find( "<!--StartFragment-->" )) != -1 ) { - start += 20; - int end = t.find( "<!--EndFragment-->" ); - TQTextCursor oldC = *cursor; - - // during the setRichTextInternal() call the cursors - // paragraph might get joined with the provious one, so - // the cursors one would get deleted and oldC.paragraph() - // would be a dnagling pointer. To avoid that try to go - // one letter back and later go one forward again. - oldC.gotoPreviousLetter(); - bool couldGoBack = oldC != *cursor; - // first para might get deleted, so remember to reset it - bool wasAtFirst = oldC.paragraph() == doc->firstParagraph(); - - if ( start < end ) - t = t.mid( start, end - start ); - else - t = t.mid( start ); - lastFormatted = cursor->paragraph(); - if ( lastFormatted->prev() ) - lastFormatted = lastFormatted->prev(); - doc->setRichTextInternal( t, cursor ); - - // the first para might have been deleted in - // setRichTextInternal(). To be sure, reset it if - // necessary. - if ( wasAtFirst ) { - int index = oldC.index(); - oldC.setParagraph( doc->firstParagraph() ); - oldC.setIndex( index ); - } - - // if we went back one letter before (see last comment), - // go one forward to point to the right position - if ( couldGoBack ) - oldC.gotoNextLetter(); - - if ( undoEnabled && !isReadOnly() ) { - doc->setSelectionStart( TQTextDocument::Temp, oldC ); - doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); - - checkUndoRedoInfo( UndoRedoInfo::Insert ); - if ( !undoRedoInfo.valid() ) { - undoRedoInfo.id = oldC.paragraph()->paragId(); - undoRedoInfo.index = oldC.index(); - undoRedoInfo.d->text = TQString::null; - } - int oldLen = undoRedoInfo.d->text.length(); - if ( !doc->preProcessor() ) { - TQString txt = doc->selectedText( TQTextDocument::Temp ); - undoRedoInfo.d->text += txt; - for ( int i = 0; i < (int)txt.length(); ++i ) { - if ( txt[ i ] != '\n' && oldC.paragraph()->at( oldC.index() )->format() ) { - oldC.paragraph()->at( oldC.index() )->format()->addRef(); - undoRedoInfo.d->text. - setFormat( oldLen + i, oldC.paragraph()->at( oldC.index() )->format(), TRUE ); - } - oldC.gotoNextLetter(); - } - } - undoRedoInfo.clear(); - removeSelection( TQTextDocument::Temp ); - } - - formatMore(); - setModified(); - emit textChanged(); - repaintChanged(); - ensureCursorVisible(); - return; - } - } else { -#if defined(Q_OS_WIN32) - // Need to convert CRLF to LF - t.replace( "\r\n", "\n" ); -#elif defined(Q_OS_MAC) - //need to convert CR to LF - t.replace( '\r', '\n' ); -#endif - TQChar *uc = (TQChar *)t.unicode(); - for ( int i=0; (uint) i<t.length(); i++ ) { - if ( uc[ i ] < ' ' && uc[ i ] != '\n' && uc[ i ] != '\t' ) - uc[ i ] = ' '; - } - if ( !t.isEmpty() ) - insert( t, FALSE, TRUE ); - } -#endif //TQT_NO_MIME -} - -#ifndef TQT_NO_MIMECLIPBOARD -/*! - Prompts the user to choose a type from a list of text types - available, then copies text from the clipboard (if there is any) - into the text edit at the current text cursor position. Any - selected text (in selection 0) is first deleted. -*/ -void TQTextEdit::pasteSpecial( const TQPoint& pt ) -{ - TQCString st = pickSpecial( TQApplication::clipboard()->data( d->clipboard_mode ), - TRUE, pt ); - if ( !st.isEmpty() ) - pasteSubType( st ); -} -#endif -#ifndef TQT_NO_MIME -TQCString TQTextEdit::pickSpecial( TQMimeSource* ms, bool always_ask, const TQPoint& pt ) -{ - if ( ms ) { -#ifndef TQT_NO_POPUPMENU - TQPopupMenu popup( this, "qt_pickspecial_menu" ); - TQString fmt; - int n = 0; - TQDict<void> done; - for (int i = 0; !( fmt = ms->format( i ) ).isNull(); i++) { - int semi = fmt.find( ";" ); - if ( semi >= 0 ) - fmt = fmt.left( semi ); - if ( fmt.left( 5 ) == "text/" ) { - fmt = fmt.mid( 5 ); - if ( !done.find( fmt ) ) { - done.insert( fmt,(void*)1 ); - popup.insertItem( fmt, i ); - n++; - } - } - } - if ( n ) { - int i = n ==1 && !always_ask ? popup.idAt( 0 ) : popup.exec( pt ); - if ( i >= 0 ) - return popup.text(i).latin1(); - } -#else - TQString fmt; - for (int i = 0; !( fmt = ms->format( i ) ).isNull(); i++) { - int semi = fmt.find( ";" ); - if ( semi >= 0 ) - fmt = fmt.left( semi ); - if ( fmt.left( 5 ) == "text/" ) { - fmt = fmt.mid( 5 ); - return fmt.latin1(); - } - } -#endif - } - return TQCString(); -} -#endif // TQT_NO_MIME -#endif // TQT_NO_CLIPBOARD - -/*! - \enum TQTextEdit::WordWrap - - This enum defines the TQTextEdit's word wrap modes. - - \value NoWrap Do not wrap the text. - - \value WidgetWidth Wrap the text at the current width of the - widget (this is the default). Wrapping is at whitespace by - default; this can be changed with setWrapPolicy(). - - \value FixedPixelWidth Wrap the text at a fixed number of pixels - from the widget's left side. The number of pixels is set with - wrapColumnOrWidth(). - - \value FixedColumnWidth Wrap the text at a fixed number of - character columns from the widget's left side. The number of - characters is set with wrapColumnOrWidth(). This is useful if you - need formatted text that can also be displayed gracefully on - devices with monospaced fonts, for example a standard VT100 - terminal, where you might set wrapColumnOrWidth() to 80. - - \sa setWordWrap() wordWrap() -*/ - -/*! - \property TQTextEdit::wordWrap - \brief the word wrap mode - - The default mode is \c WidgetWidth which causes words to be - wrapped at the right edge of the text edit. Wrapping occurs at - whitespace, keeping whole words intact. If you want wrapping to - occur within words use setWrapPolicy(). If you set a wrap mode of - \c FixedPixelWidth or \c FixedColumnWidth you should also call - setWrapColumnOrWidth() with the width you want. - - \sa WordWrap, wrapColumnOrWidth, wrapPolicy, -*/ - -void TQTextEdit::setWordWrap( WordWrap mode ) -{ - if ( wrapMode == mode ) - return; - wrapMode = mode; - switch ( mode ) { - case NoWrap: - document()->formatter()->setWrapEnabled( FALSE ); - document()->formatter()->setWrapAtColumn( -1 ); - doc->setWidth( visibleWidth() ); - doc->setMinimumWidth( -1 ); - doc->invalidate(); - updateContents(); - lastFormatted = doc->firstParagraph(); - interval = 0; - formatMore(); - break; - case WidgetWidth: - document()->formatter()->setWrapEnabled( TRUE ); - document()->formatter()->setWrapAtColumn( -1 ); - doResize(); - break; - case FixedPixelWidth: - document()->formatter()->setWrapEnabled( TRUE ); - document()->formatter()->setWrapAtColumn( -1 ); - if ( wrapWidth < 0 ) - wrapWidth = 200; - setWrapColumnOrWidth( wrapWidth ); - break; - case FixedColumnWidth: - if ( wrapWidth < 0 ) - wrapWidth = 80; - document()->formatter()->setWrapEnabled( TRUE ); - document()->formatter()->setWrapAtColumn( wrapWidth ); - setWrapColumnOrWidth( wrapWidth ); - break; - } -#ifdef QT_TEXTEDIT_OPTIMIZATION - checkOptimMode(); -#endif -} - -TQTextEdit::WordWrap TQTextEdit::wordWrap() const -{ - return wrapMode; -} - -/*! - \property TQTextEdit::wrapColumnOrWidth - \brief the position (in pixels or columns depending on the wrap mode) where text will be wrapped - - If the wrap mode is \c FixedPixelWidth, the value is the number of - pixels from the left edge of the text edit at which text should be - wrapped. If the wrap mode is \c FixedColumnWidth, the value is the - column number (in character columns) from the left edge of the - text edit at which text should be wrapped. - - \sa wordWrap -*/ -void TQTextEdit::setWrapColumnOrWidth( int value ) -{ - wrapWidth = value; - if ( wrapMode == FixedColumnWidth ) { - document()->formatter()->setWrapAtColumn( wrapWidth ); - resizeContents( 0, 0 ); - doc->setWidth( visibleWidth() ); - doc->setMinimumWidth( -1 ); - } else if (wrapMode == FixedPixelWidth ) { - document()->formatter()->setWrapAtColumn( -1 ); - resizeContents( wrapWidth, 0 ); - doc->setWidth( wrapWidth ); - doc->setMinimumWidth( wrapWidth ); - } else { - return; - } - doc->invalidate(); - updateContents(); - lastFormatted = doc->firstParagraph(); - interval = 0; - formatMore(); -} - -int TQTextEdit::wrapColumnOrWidth() const -{ - if ( wrapMode == WidgetWidth ) - return visibleWidth(); - return wrapWidth; -} - - -/*! - \enum TQTextEdit::WrapPolicy - - This enum defines where text can be wrapped in word wrap mode. - - \value AtWhiteSpace Don't use this deprecated value (it is a - synonym for \c AtWordBoundary which you should use instead). - \value Anywhere Break anywhere, including within words. - \value AtWordBoundary Break lines at word boundaries, e.g. spaces or - newlines - \value AtWordOrDocumentBoundary Break lines at whitespace, e.g. - spaces or newlines if possible. Break it anywhere otherwise. - - \sa setWrapPolicy() -*/ - -/*! - \property TQTextEdit::wrapPolicy - \brief the word wrap policy, at whitespace or anywhere - - Defines where text can be wrapped when word wrap mode is not \c - NoWrap. The choices are \c AtWordBoundary (the default), \c - Anywhere and \c AtWordOrDocumentBoundary - - \sa wordWrap -*/ - -void TQTextEdit::setWrapPolicy( WrapPolicy policy ) -{ - if ( wPolicy == policy ) - return; - wPolicy = policy; - TQTextFormatter *formatter; - if ( policy == AtWordBoundary || policy == AtWordOrDocumentBoundary ) { - formatter = new TQTextFormatterBreakWords; - formatter->setAllowBreakInWords( policy == AtWordOrDocumentBoundary ); - } else { - formatter = new TQTextFormatterBreakInWords; - } - formatter->setWrapAtColumn( document()->formatter()->wrapAtColumn() ); - formatter->setWrapEnabled( document()->formatter()->isWrapEnabled( 0 ) ); - document()->setFormatter( formatter ); - doc->invalidate(); - updateContents(); - lastFormatted = doc->firstParagraph(); - interval = 0; - formatMore(); -} - -TQTextEdit::WrapPolicy TQTextEdit::wrapPolicy() const -{ - return wPolicy; -} - -/*! - Deletes all the text in the text edit. - - \sa cut() removeSelectedText() setText() -*/ - -void TQTextEdit::clear() -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - optimSetText(""); - } else -#endif - { - // make clear undoable - doc->selectAll( TQTextDocument::Temp ); - removeSelectedText( TQTextDocument::Temp ); - setContentsPos( 0, 0 ); - if ( cursor->isValid() ) - cursor->restoreState(); - doc->clear( TRUE ); - delete cursor; - cursor = new TQTextCursor( doc ); - lastFormatted = 0; - } - updateContents(); - - emit cursorPositionChanged( cursor ); - emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); -} - -int TQTextEdit::undoDepth() const -{ - return document()->undoDepth(); -} - -/*! - \property TQTextEdit::length - \brief the number of characters in the text -*/ - -int TQTextEdit::length() const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) - return d->od->len; - else -#endif - return document()->length(); -} - -/*! - \property TQTextEdit::tabStopWidth - \brief the tab stop width in pixels -*/ - -int TQTextEdit::tabStopWidth() const -{ - return document()->tabStopWidth(); -} - -void TQTextEdit::setUndoDepth( int d ) -{ - document()->setUndoDepth( d ); -} - -void TQTextEdit::setTabStopWidth( int ts ) -{ - document()->setTabStops( ts ); - doc->invalidate(); - lastFormatted = doc->firstParagraph(); - interval = 0; - formatMore(); - updateContents(); -} - -/*! - \reimp -*/ - -TQSize TQTextEdit::sizeHint() const -{ - // cf. TQScrollView::sizeHint() - constPolish(); - int f = 2 * frameWidth(); - int h = fontMetrics().height(); - TQSize sz( f, f ); - return sz.expandedTo( TQSize(12 * h, 8 * h) ); -} - -void TQTextEdit::clearUndoRedo() -{ - if ( !undoEnabled ) - return; - undoRedoInfo.clear(); - emit undoAvailable( doc->commands()->isUndoAvailable() ); - emit redoAvailable( doc->commands()->isRedoAvailable() ); -} - -/*! \internal - \warning In TQt 3.1 we will provide a cleaer API for the - functionality which is provided by this function and in TQt 4.0 this - function will go away. - - This function gets the format of the character at position \a - index in paragraph \a para. Sets \a font to the character's font, \a - color to the character's color and \a verticalAlignment to the - character's vertical alignment. - - Returns FALSE if \a para or \a index is out of range otherwise - returns TRUE. -*/ - -bool TQTextEdit::getFormat( int para, int index, TQFont *font, TQColor *color, VerticalAlignment *verticalAlignment ) -{ - if ( !font || !color ) - return FALSE; - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return FALSE; - if ( index < 0 || index >= p->length() ) - return FALSE; - *font = p->at( index )->format()->font(); - *color = p->at( index )->format()->color(); - *verticalAlignment = (VerticalAlignment)p->at( index )->format()->vAlign(); - return TRUE; -} - -/*! \internal - \warning In TQt 3.1 we will provide a cleaer API for the - functionality which is provided by this function and in TQt 4.0 this - function will go away. - - This function gets the format of the paragraph \a para. Sets \a - font to the paragraphs's font, \a color to the paragraph's color, \a - verticalAlignment to the paragraph's vertical alignment, \a - alignment to the paragraph's alignment, \a displayMode to the - paragraph's display mode, \a listStyle to the paragraph's list style - (if the display mode is TQStyleSheetItem::DisplayListItem) and \a - listDepth to the depth of the list (if the display mode is - TQStyleSheetItem::DisplayListItem). - - Returns FALSE if \a para is out of range otherwise returns TRUE. -*/ - -bool TQTextEdit::getParagraphFormat( int para, TQFont *font, TQColor *color, - VerticalAlignment *verticalAlignment, int *alignment, - TQStyleSheetItem::DisplayMode *displayMode, - TQStyleSheetItem::ListStyle *listStyle, - int *listDepth ) -{ - if ( !font || !color || !alignment || !displayMode || !listStyle ) - return FALSE; - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return FALSE; - *font = p->at(0)->format()->font(); - *color = p->at(0)->format()->color(); - *verticalAlignment = (VerticalAlignment)p->at(0)->format()->vAlign(); - *alignment = p->alignment(); - *displayMode = p->isListItem() ? TQStyleSheetItem::DisplayListItem : TQStyleSheetItem::DisplayBlock; - *listStyle = p->listStyle(); - *listDepth = p->listDepth(); - return TRUE; -} - - - -/*! - This function is called to create a right mouse button popup menu - at the document position \a pos. If you want to create a custom - popup menu, reimplement this function and return the created popup - menu. Ownership of the popup menu is transferred to the caller. - - \warning The TQPopupMenu ID values 0-7 are reserved, and they map to the - standard operations. When inserting items into your custom popup menu, be - sure to specify ID values larger than 7. -*/ - -TQPopupMenu *TQTextEdit::createPopupMenu( const TQPoint& pos ) -{ - Q_UNUSED( pos ) -#ifndef TQT_NO_POPUPMENU - TQPopupMenu *popup = new TQPopupMenu( this, "qt_edit_menu" ); - if ( !isReadOnly() ) { - d->id[ IdUndo ] = popup->insertItem( tr( "&Undo" ) + ACCEL_KEY( Z ) ); - d->id[ IdRedo ] = popup->insertItem( tr( "&Redo" ) + ACCEL_KEY( Y ) ); - popup->insertSeparator(); - } -#ifndef TQT_NO_CLIPBOARD - if ( !isReadOnly() ) - d->id[ IdCut ] = popup->insertItem( tr( "Cu&t" ) + ACCEL_KEY( X ) ); - d->id[ IdCopy ] = popup->insertItem( tr( "&Copy" ) + ACCEL_KEY( C ) ); - if ( !isReadOnly() ) - d->id[ IdPaste ] = popup->insertItem( tr( "&Paste" ) + ACCEL_KEY( V ) ); -#endif - if ( !isReadOnly() ) { - d->id[ IdClear ] = popup->insertItem( tr( "Clear" ) ); - popup->insertSeparator(); - } -#if defined(TQ_WS_X11) - d->id[ IdSelectAll ] = popup->insertItem( tr( "Select All" ) ); -#else - d->id[ IdSelectAll ] = popup->insertItem( tr( "Select All" ) + ACCEL_KEY( A ) ); -#endif - -#ifndef TQT_NO_IM - TQInputContext *qic = getInputContext(); - if ( qic ) - qic->addMenusTo( popup ); -#endif - - popup->setItemEnabled( d->id[ IdUndo ], !isReadOnly() && doc->commands()->isUndoAvailable() ); - popup->setItemEnabled( d->id[ IdRedo ], !isReadOnly() && doc->commands()->isRedoAvailable() ); -#ifndef TQT_NO_CLIPBOARD - popup->setItemEnabled( d->id[ IdCut ], !isReadOnly() && doc->hasSelection( TQTextDocument::Standard, TRUE ) ); -#ifdef QT_TEXTEDIT_OPTIMIZATION - popup->setItemEnabled( d->id[ IdCopy ], d->optimMode ? optimHasSelection() : doc->hasSelection( TQTextDocument::Standard, TRUE ) ); -#else - popup->setItemEnabled( d->id[ IdCopy ], doc->hasSelection( TQTextDocument::Standard, TRUE ) ); -#endif - popup->setItemEnabled( d->id[ IdPaste ], !isReadOnly() && !TQApplication::clipboard()->text( d->clipboard_mode ).isEmpty() ); -#endif - const bool isEmptyDocument = (length() == 0); - popup->setItemEnabled( d->id[ IdClear ], !isReadOnly() && !isEmptyDocument ); - popup->setItemEnabled( d->id[ IdSelectAll ], !isEmptyDocument ); - return popup; -#else - return 0; -#endif -} - -/*! \overload - \obsolete - This function is called to create a right mouse button popup menu. - If you want to create a custom popup menu, reimplement this function - and return the created popup menu. Ownership of the popup menu is - transferred to the caller. - - This function is only called if createPopupMenu( const TQPoint & ) - returns 0. -*/ - -TQPopupMenu *TQTextEdit::createPopupMenu() -{ - return 0; -} - -/*! - \reimp -*/ - -void TQTextEdit::setFont( const TQFont &f ) -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - TQScrollView::setFont( f ); - doc->setDefaultFormat( f, doc->formatCollection()->defaultFormat()->color() ); - // recalculate the max string width - TQFontMetrics fm(f); - int i, sw; - d->od->maxLineWidth = 0; - for ( i = 0; i < d->od->numLines; i++ ) { - sw = fm.width(d->od->lines[LOGOFFSET(i)]); - if (d->od->maxLineWidth < sw) - d->od->maxLineWidth = sw; - } - resizeContents(d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1); - return; - } -#endif - TQScrollView::setFont( f ); - doc->setMinimumWidth( -1 ); - doc->setDefaultFormat( f, doc->formatCollection()->defaultFormat()->color() ); - lastFormatted = doc->firstParagraph(); - formatMore(); - repaintChanged(); -} - -/*! - \fn TQTextEdit::zoomIn() - - \overload - - Zooms in on the text by making the base font size one point - larger and recalculating all font sizes to be the new size. This - does not change the size of any images. - - \sa zoomOut() -*/ - -/*! - \fn TQTextEdit::zoomOut() - - \overload - - Zooms out on the text by making the base font size one point - smaller and recalculating all font sizes to be the new size. This - does not change the size of any images. - - \sa zoomIn() -*/ - - -/*! - Zooms in on the text by making the base font size \a range - points larger and recalculating all font sizes to be the new size. - This does not change the size of any images. - - \sa zoomOut() -*/ - -void TQTextEdit::zoomIn( int range ) -{ - TQFont f( TQScrollView::font() ); - TQFontInfo fi(f); - if (fi.pointSize() <= 0) { - f.setPixelSize( fi.pixelSize() + range ); - } else { - f.setPointSize( fi.pointSize() + range ); - } - setFont( f ); -} - -/*! - Zooms out on the text by making the base font size \a range points - smaller and recalculating all font sizes to be the new size. This - does not change the size of any images. - - \sa zoomIn() -*/ - -void TQTextEdit::zoomOut( int range ) -{ - TQFont f( TQScrollView::font() ); - TQFontInfo fi(f); - if (fi.pointSize() <= 0) { - f.setPixelSize( TQMAX( 1, fi.pixelSize() - range ) ); - } else { - f.setPointSize( TQMAX( 1, fi.pointSize() - range ) ); - } - setFont( f ); -} - -/*! - Zooms the text by making the base font size \a size points and - recalculating all font sizes to be the new size. This does not - change the size of any images. -*/ - -void TQTextEdit::zoomTo( int size ) -{ - TQFont f( TQScrollView::font() ); - f.setPointSize( size ); - setFont( f ); -} - -/*! - TQTextEdit is optimized for large amounts text. One of its - optimizations is to format only the visible text, formatting the rest - on demand, e.g. as the user scrolls, so you don't usually need to - call this function. - - In some situations you may want to force the whole text - to be formatted. For example, if after calling setText(), you wanted - to know the height of the document (using contentsHeight()), you - would call this function first. -*/ - -void TQTextEdit::sync() -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - TQFontMetrics fm( TQScrollView::font() ); - resizeContents( d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1 ); - } else -#endif - { - while ( lastFormatted ) { - lastFormatted->format(); - lastFormatted = lastFormatted->next(); - } - resizeContents( contentsWidth(), doc->height() ); - } - updateScrollBars(); -} - -/*! - \reimp -*/ - -void TQTextEdit::setEnabled( bool b ) -{ - TQScrollView::setEnabled( b ); - if ( textFormat() == PlainText ) { - TQTextFormat *f = doc->formatCollection()->defaultFormat(); - f->setColor( colorGroup().text() ); - updateContents(); - } -} - -/*! - Sets the background color of selection number \a selNum to \a back - and specifies whether the text of this selection should be - inverted with \a invertText. - - This only works for \a selNum > 0. The default selection (\a - selNum == 0) gets its attributes from the text edit's - colorGroup(). -*/ - -void TQTextEdit::setSelectionAttributes( int selNum, const TQColor &back, bool invertText ) -{ - if ( selNum < 1 ) - return; - if ( selNum > doc->numSelections() ) - doc->addSelection( selNum ); - doc->setSelectionColor( selNum, back ); - doc->setInvertSelectionText( selNum, invertText ); -} - -/*! - \reimp -*/ -void TQTextEdit::windowActivationChange( bool oldActive ) -{ - if ( oldActive && scrollTimer ) - scrollTimer->stop(); - if ( palette().active() != palette().inactive() ) - updateContents(); - TQScrollView::windowActivationChange( oldActive ); -} - -void TQTextEdit::setReadOnly( bool b ) -{ - if ( (bool) readOnly == b ) - return; - readOnly = b; -#ifndef TQT_NO_CURSOR - if ( readOnly ) - viewport()->setCursor( arrowCursor ); - else - viewport()->setCursor( ibeamCursor ); - setInputMethodEnabled( !readOnly ); -#endif -#ifdef QT_TEXTEDIT_OPTIMIZATION - checkOptimMode(); -#endif -} - -/*! - Scrolls to the bottom of the document and does formatting if - required. -*/ - -void TQTextEdit::scrollToBottom() -{ - sync(); - setContentsPos( contentsX(), contentsHeight() - visibleHeight() ); -} - -/*! - Returns the rectangle of the paragraph \a para in contents - coordinates, or an invalid rectangle if \a para is out of range. -*/ - -TQRect TQTextEdit::paragraphRect( int para ) const -{ - TQTextEdit *that = (TQTextEdit *)this; - that->sync(); - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return TQRect( -1, -1, -1, -1 ); - return p->rect(); -} - -/*! - Returns the paragraph which is at position \a pos (in contents - coordinates). -*/ - -int TQTextEdit::paragraphAt( const TQPoint &pos ) const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - TQFontMetrics fm( TQScrollView::font() ); - int parag = pos.y() / fm.lineSpacing(); - if ( parag <= d->od->numLines ) - return parag; - else - return 0; - } -#endif - TQTextCursor c( doc ); - c.place( pos, doc->firstParagraph() ); - if ( c.paragraph() ) - return c.paragraph()->paragId(); - return -1; // should never happen.. -} - -/*! - Returns the index of the character (relative to its paragraph) at - position \a pos (in contents coordinates). If \a para is not 0, - \a *para is set to the character's paragraph. -*/ - -int TQTextEdit::charAt( const TQPoint &pos, int *para ) const -{ -#ifdef QT_TEXTEDIT_OPTIMIZATION - if ( d->optimMode ) { - int par = paragraphAt( pos ); - if ( para ) - *para = par; - return optimCharIndex( d->od->lines[ LOGOFFSET(par) ], pos.x() ); - } -#endif - TQTextCursor c( doc ); - c.place( pos, doc->firstParagraph() ); - if ( c.paragraph() ) { - if ( para ) - *para = c.paragraph()->paragId(); - return c.index(); - } - return -1; // should never happen.. -} - -/*! - Sets the background color of the paragraph \a para to \a bg. -*/ - -void TQTextEdit::setParagraphBackgroundColor( int para, const TQColor &bg ) -{ - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return; - p->setBackgroundColor( bg ); - repaintChanged(); -} - -/*! - Clears the background color of the paragraph \a para, so that the - default color is used again. -*/ - -void TQTextEdit::clearParagraphBackground( int para ) -{ - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return; - p->clearBackgroundColor(); - repaintChanged(); -} - -/*! - Returns the background color of the paragraph \a para or an - invalid color if \a para is out of range or the paragraph has no - background set -*/ - -TQColor TQTextEdit::paragraphBackgroundColor( int para ) const -{ - TQTextParagraph *p = doc->paragAt( para ); - if ( !p ) - return TQColor(); - TQColor *c = p->backgroundColor(); - if ( c ) - return *c; - return TQColor(); -} - -/*! - \property TQTextEdit::undoRedoEnabled - \brief whether undo/redo is enabled - - When changing this property, the undo/redo history is cleared. - - The default is TRUE. -*/ - -void TQTextEdit::setUndoRedoEnabled( bool b ) -{ - undoRedoInfo.clear(); - doc->commands()->clear(); - - undoEnabled = b; -} - -bool TQTextEdit::isUndoRedoEnabled() const -{ - return undoEnabled; -} - -/*! - Returns TRUE if undo is available; otherwise returns FALSE. -*/ - -bool TQTextEdit::isUndoAvailable() const -{ - return undoEnabled && (doc->commands()->isUndoAvailable() || undoRedoInfo.valid()); -} - -/*! - Returns TRUE if redo is available; otherwise returns FALSE. -*/ - -bool TQTextEdit::isRedoAvailable() const -{ - return undoEnabled && doc->commands()->isRedoAvailable(); -} - -void TQTextEdit::ensureFormatted( TQTextParagraph *p ) -{ - while ( !p->isValid() ) { - if ( !lastFormatted ) - return; - formatMore(); - } -} - -/*! \internal */ -void TQTextEdit::updateCursor( const TQPoint & pos ) -{ - if ( isReadOnly() && linksEnabled() ) { - TQTextCursor c = *cursor; - placeCursor( pos, &c, TRUE ); - -#ifndef TQT_NO_NETWORKPROTOCOL - bool insideParagRect = TRUE; - if (c.paragraph() == doc->lastParagraph() - && c.paragraph()->rect().y() + c.paragraph()->rect().height() < pos.y()) - insideParagRect = FALSE; - if (insideParagRect && c.paragraph() && c.paragraph()->at( c.index() ) && - c.paragraph()->at( c.index() )->isAnchor()) { - if (!c.paragraph()->at( c.index() )->anchorHref().isEmpty() - && c.index() < c.paragraph()->length() - 1 ) - onLink = c.paragraph()->at( c.index() )->anchorHref(); - else - onLink = TQString::null; - - if (!c.paragraph()->at( c.index() )->anchorName().isEmpty() - && c.index() < c.paragraph()->length() - 1 ) - d->onName = c.paragraph()->at( c.index() )->anchorName(); - else - d->onName = TQString::null; - - if (!c.paragraph()->at( c.index() )->anchorHref().isEmpty() ) { -#ifndef TQT_NO_CURSOR - viewport()->setCursor( onLink.isEmpty() ? arrowCursor : pointingHandCursor ); -#endif - TQUrl u( doc->context(), onLink, TRUE ); - emitHighlighted( u.toString( FALSE, FALSE ) ); - } - } else { -#ifndef TQT_NO_CURSOR - viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); -#endif - onLink = TQString::null; - emitHighlighted( TQString::null ); - } -#endif - } -} - -/*! - Places the cursor \a c at the character which is closest to position - \a pos (in contents coordinates). If \a c is 0, the default text - cursor is used. - - \sa setCursorPosition() -*/ -void TQTextEdit::placeCursor( const TQPoint &pos, TQTextCursor *c ) -{ - placeCursor( pos, c, FALSE ); -} - -/*! \internal */ -void TQTextEdit::clipboardChanged() -{ -#ifndef TQT_NO_CLIPBOARD - // don't listen to selection changes - disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), this, 0); -#endif - selectAll(FALSE); -} - -/*! \property TQTextEdit::tabChangesFocus - \brief whether TAB changes focus or is accepted as input - - In some occasions text edits should not allow the user to input - tabulators or change indentation using the TAB key, as this breaks - the focus chain. The default is FALSE. - -*/ - -void TQTextEdit::setTabChangesFocus( bool b ) -{ - d->tabChangesFocus = b; -} - -bool TQTextEdit::tabChangesFocus() const -{ - return d->tabChangesFocus; -} - -#ifdef QT_TEXTEDIT_OPTIMIZATION -/* Implementation of optimized LogText mode follows */ - -static void tqSwap( int * a, int * b ) -{ - if ( !a || !b ) - return; - int tmp = *a; - *a = *b; - *b = tmp; -} - -/*! \internal */ -bool TQTextEdit::checkOptimMode() -{ - bool oldMode = d->optimMode; - if ( textFormat() == LogText ) { - setReadOnly( TRUE ); - d->optimMode = TRUE; - } else { - d->optimMode = FALSE; - } - - // when changing mode - try to keep selections and text - if ( oldMode != d->optimMode ) { - if ( d->optimMode ) { - d->od = new TQTextEditOptimPrivate; - connect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( optimDoAutoScroll() ) ); - disconnect( doc, TQ_SIGNAL( minimumWidthChanged(int) ), this, TQ_SLOT( documentWidthChanged(int) ) ); - disconnect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( autoScrollTimerDone() ) ); - disconnect( formatTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( formatMore() ) ); - optimSetText( doc->originalText() ); - doc->clear(TRUE); - delete cursor; - cursor = new TQTextCursor( doc ); - } else { - disconnect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( optimDoAutoScroll() ) ); - connect( doc, TQ_SIGNAL( minimumWidthChanged(int) ), this, TQ_SLOT( documentWidthChanged(int) ) ); - connect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( autoScrollTimerDone() ) ); - connect( formatTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( formatMore() ) ); - setText( optimText() ); - delete d->od; - d->od = 0; - } - } - return d->optimMode; -} - -/*! \internal */ -TQString TQTextEdit::optimText() const -{ - TQString str, tmp; - - if ( d->od->len == 0 ) - return str; - - // concatenate all strings - int i; - int offset; - TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; - TQTextEditOptimPrivate::Tag * ftag = 0; - for ( i = 0; i < d->od->numLines; i++ ) { - if ( d->od->lines[ LOGOFFSET(i) ].isEmpty() ) { // CR lines are empty - str += "\n"; - } else { - tmp = d->od->lines[ LOGOFFSET(i) ] + "\n"; - // inject the tags for this line - if ( (it = d->od->tagIndex.find( LOGOFFSET(i) )) != d->od->tagIndex.end() ) - ftag = it.data(); - offset = 0; - while ( ftag && ftag->line == i ) { - tmp.insert( ftag->index + offset, "<" + ftag->tag + ">" ); - offset += ftag->tag.length() + 2; // 2 -> the '<' and '>' chars - ftag = ftag->next; - } - str += tmp; - } - } - return str; -} - -/*! \internal */ -void TQTextEdit::optimSetText( const TQString &str ) -{ - optimRemoveSelection(); -// this is just too slow - but may have to go in due to compatibility reasons -// if ( str == optimText() ) -// return; - d->od->numLines = 0; - d->od->lines.clear(); - d->od->maxLineWidth = 0; - d->od->len = 0; - d->od->clearTags(); - TQFontMetrics fm( TQScrollView::font() ); - if ( !(str.isEmpty() || str.isNull() || d->maxLogLines == 0) ) { - TQStringList strl = TQStringList::split( '\n', str, TRUE ); - int lWidth = 0; - for ( TQStringList::Iterator it = strl.begin(); it != strl.end(); ++it ) { - optimParseTags( &*it ); - optimCheckLimit( *it ); - lWidth = fm.width( *it ); - if ( lWidth > d->od->maxLineWidth ) - d->od->maxLineWidth = lWidth; - } - } - resizeContents( d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1 ); - repaintContents(); - emit textChanged(); -} - -/*! \internal - - Append \a tag to the tag list. -*/ -TQTextEditOptimPrivate::Tag * TQTextEdit::optimAppendTag( int index, const TQString & tag ) -{ - TQTextEditOptimPrivate::Tag * t = new TQTextEditOptimPrivate::Tag, * tmp; - - if ( d->od->tags == 0 ) - d->od->tags = t; - t->bold = t->italic = t->underline = FALSE; - t->line = d->od->numLines; - t->index = index; - t->tag = tag; - t->leftTag = 0; - t->parent = 0; - t->prev = d->od->lastTag; - if ( d->od->lastTag ) - d->od->lastTag->next = t; - t->next = 0; - d->od->lastTag = t; - tmp = d->od->tagIndex[ LOGOFFSET(t->line) ]; - if ( !tmp || (tmp && tmp->index > t->index) ) { - d->od->tagIndex.replace( LOGOFFSET(t->line), t ); - } - return t; -} - - /*! \internal - - Insert \a tag in the tag - according to line and index numbers -*/ - -TQTextEditOptimPrivate::Tag *TQTextEdit::optimInsertTag(int line, int index, const TQString &tag) -{ - TQTextEditOptimPrivate::Tag *t = new TQTextEditOptimPrivate::Tag, *tmp; - - if (d->od->tags == 0) - d->od->tags = t; - t->bold = t->italic = t->underline = FALSE; - t->line = line; - t->index = index; - t->tag = tag; - t->leftTag = 0; - t->parent = 0; - t->next = 0; - t->prev = 0; - - // find insertion pt. in tag struct. - TQMap<int,TQTextEditOptimPrivate::Tag *>::ConstIterator it; - if ((it = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { - tmp = *it; - if (tmp->index >= index) { // the exisiting tag may be placed AFTER the one we want to insert - tmp = tmp->prev; - } else { - while (tmp && tmp->next && tmp->next->line == line && tmp->next->index <= index) - tmp = tmp->next; - } - } else { - tmp = d->od->tags; - while (tmp && tmp->next && tmp->next->line < line) - tmp = tmp->next; - if (tmp == d->od->tags) - tmp = 0; - } - - t->prev = tmp; - t->next = tmp ? tmp->next : 0; - if (t->next) - t->next->prev = t; - if (tmp) - tmp->next = t; - - tmp = d->od->tagIndex[LOGOFFSET(t->line)]; - if (!tmp || (tmp && tmp->index >= t->index)) { - d->od->tagIndex.replace(LOGOFFSET(t->line), t); - } - return t; -} - - -/*! \internal - - Find tags in \a line, remove them from \a line and put them in a - structure. - - A tag is delimited by '<' and '>'. The characters '<', '>' and '&' - are escaped by using '<', '>' and '&'. Left-tags marks - the starting point for formatting, while right-tags mark the ending - point. A right-tag is the same as a left-tag, but with a '/' - appearing before the tag keyword. E.g a valid left-tag: <b>, and - a valid right-tag: </b>. Tags can be nested, but they have to be - closed in the same order as they are opened. E.g: - <font color=red><font color=blue>blue</font>red</font> - is valid, while: - <font color=red><b>bold red</font> just bold</b> - is invalid since the font tag is - closed before the bold tag. Note that a tag does not have to be - closed: '<font color=blue>Lots of text - and then some..' is perfectly valid for - setting all text appearing after the tag to blue. A tag can be used - to change the color of a piece of text, or set one of the following - formatting attributes: bold, italic and underline. These attributes - are set using the <b>, <i> and <u> tags. Example of valid tags: - <font color=red>, </font>, <b>, <u>, <i>, </i>. - Example of valid text: - This is some <font color=red>red text</font>, while this is some <font color=green>green - text</font>. <font color=blue><font color=yellow>This is yellow</font>, while this is - blue.</font> - - Note that only the color attribute of the HTML font tag is supported. - - Limitations: - 1. A tag cannot span several lines. - 2. Very limited error checking - mismatching left/right-tags is the - only thing that is detected. - -*/ -void TQTextEdit::optimParseTags( TQString * line, int lineNo, int indexOffset ) -{ - int len = line->length(); - int i, startIndex = -1, endIndex = -1, escIndex = -1; - int state = 0; // 0 = outside tag, 1 = inside tag - bool tagOpen, tagClose; - int bold = 0, italic = 0, underline = 0; - TQString tagStr; - TQPtrStack<TQTextEditOptimPrivate::Tag> tagStack; - - for ( i = 0; i < len; i++ ) { - tagOpen = (*line)[i] == '<'; - tagClose = (*line)[i] == '>'; - - // handle '<' and '>' and '&' - if ( (*line)[i] == '&' ) { - escIndex = i; - continue; - } else if ( escIndex != -1 && (*line)[i] == ';' ) { - TQString esc = line->mid( escIndex, i - escIndex + 1 ); - TQString c; - if ( esc == "<" ) - c = '<'; - else if ( esc == ">" ) - c = '>'; - else if ( esc == "&" ) - c = '&'; - line->replace( escIndex, i - escIndex + 1, c ); - len = line->length(); - i -= i-escIndex; - escIndex = -1; - continue; - } - - if ( state == 0 && tagOpen ) { - state = 1; - startIndex = i; - continue; - } - if ( state == 1 && tagClose ) { - state = 0; - endIndex = i; - if ( !tagStr.isEmpty() ) { - TQTextEditOptimPrivate::Tag * tag, * cur, * tmp; - bool format = TRUE; - - if ( tagStr == "b" ) - bold++; - else if ( tagStr == "/b" ) - bold--; - else if ( tagStr == "i" ) - italic++; - else if ( tagStr == "/i" ) - italic--; - else if ( tagStr == "u" ) - underline++; - else if ( tagStr == "/u" ) - underline--; - else - format = FALSE; - if ( lineNo > -1 ) - tag = optimInsertTag( lineNo, startIndex + indexOffset, tagStr ); - else - tag = optimAppendTag( startIndex, tagStr ); - // everything that is not a b, u or i tag is considered - // to be a color tag. - tag->type = format ? TQTextEditOptimPrivate::Format - : TQTextEditOptimPrivate::Color; - if ( tagStr[0] == '/' ) { - // this is a right-tag - search for the left-tag - // and possible parent tag - cur = tag->prev; - if ( !cur ) { -#ifdef QT_CHECK_RANGE - tqWarning( "TQTextEdit::optimParseTags: no left-tag for '<%s>' in line %d.", tag->tag.ascii(), tag->line + 1 ); -#endif - return; // something is wrong - give up - } - while ( cur ) { - if ( cur->leftTag ) { // push right-tags encountered - tagStack.push( cur ); - } else { - tmp = tagStack.pop(); - if ( !tmp ) { - if ( (("/" + cur->tag) == tag->tag) || - (tag->tag == "/font" && cur->tag.left(4) == "font") ) { - // set up the left and parent of this tag - tag->leftTag = cur; - tmp = cur->prev; - if ( tmp && tmp->parent ) { - tag->parent = tmp->parent; - } else if ( tmp && !tmp->leftTag ) { - tag->parent = tmp; - } - break; - } else if ( !cur->leftTag ) { -#ifdef QT_CHECK_RANGE - tqWarning( "TQTextEdit::optimParseTags: mismatching %s-tag for '<%s>' in line %d.", cur->tag[0] == '/' ? "left" : "right", cur->tag.ascii(), cur->line + 1 ); -#endif - return; // something is amiss - give up - } - } - } - cur = cur->prev; - } - } else { - tag->bold = bold > 0; - tag->italic = italic > 0; - tag->underline = underline > 0; - tmp = tag->prev; - while ( tmp && tmp->leftTag ) { - tmp = tmp->leftTag->parent; - } - if ( tmp ) { - tag->bold |= tmp->bold; - tag->italic |= tmp->italic; - tag->underline |= tmp->underline; - } - } - } - if ( startIndex != -1 ) { - int l = (endIndex == -1) ? - line->length() - startIndex : endIndex - startIndex; - line->remove( startIndex, l+1 ); - len = line->length(); - i -= l+1; - } - tagStr = ""; - continue; - } - - if ( state == 1 ) { - tagStr += (*line)[i]; - } - } -} - -// calculate the width of a string in pixels inc. tabs -static int qStrWidth(const TQString& str, int tabWidth, const TQFontMetrics& fm) -{ - int tabs = str.contains('\t'); - - if (!tabs) - return fm.width(str); - - int newIdx = 0; - int lastIdx = 0; - int strWidth = 0; - int tn; - for (tn = 1; tn <= tabs; ++tn) { - newIdx = str.find('\t', newIdx); - strWidth += fm.width(str.mid(lastIdx, newIdx - lastIdx)); - if (strWidth >= tn * tabWidth) { - int u = tn; - while (strWidth >= u * tabWidth) - ++u; - strWidth = u * tabWidth; - } else { - strWidth = tn * tabWidth; - } - lastIdx = ++newIdx; - } - if ((int)str.length() > newIdx) - strWidth += fm.width(str.mid(newIdx)); - return strWidth; -} - -bool TQTextEdit::optimHasBoldMetrics(int line) -{ - TQTextEditOptimPrivate::Tag *t; - TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; - if ((it = d->od->tagIndex.find(line)) != d->od->tagIndex.end()) { - t = *it; - while (t && t->line == line) { - if (t->bold) - return TRUE; - t = t->next; - } - } else if ((t = optimPreviousLeftTag(line)) && t->bold) { - return TRUE; - } - return FALSE; -} - -/*! \internal - - Append \a str to the current text buffer. Parses each line to find - formatting tags. -*/ -void TQTextEdit::optimAppend( const TQString &str ) -{ - if ( str.isEmpty() || str.isNull() || d->maxLogLines == 0 ) - return; - - TQStringList strl = TQStringList::split( '\n', str, TRUE ); - TQStringList::Iterator it = strl.begin(); - - TQFontMetrics fm(TQScrollView::font()); - int lWidth = 0; - - for ( ; it != strl.end(); ++it ) { - optimParseTags( &*it ); - optimCheckLimit( *it ); - if (optimHasBoldMetrics(d->od->numLines-1)) { - TQFont fnt = TQScrollView::font(); - fnt.setBold(TRUE); - fm = TQFontMetrics(fnt); - } - lWidth = qStrWidth(*it, tabStopWidth(), fm) + 4; - if ( lWidth > d->od->maxLineWidth ) - d->od->maxLineWidth = lWidth; - } - bool scrollToEnd = contentsY() >= contentsHeight() - visibleHeight(); - resizeContents( d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1 ); - if ( scrollToEnd ) { - updateScrollBars(); - ensureVisible( contentsX(), contentsHeight(), 0, 0 ); - } - // when a max log size is set, the text may not be redrawn because - // the size of the viewport may not have changed - if ( d->maxLogLines > -1 ) - viewport()->update(); - emit textChanged(); -} - - -static void qStripTags(TQString *line) -{ - int len = line->length(); - int i, startIndex = -1, endIndex = -1, escIndex = -1; - int state = 0; // 0 = outside tag, 1 = inside tag - bool tagOpen, tagClose; - - for ( i = 0; i < len; i++ ) { - tagOpen = (*line)[i] == '<'; - tagClose = (*line)[i] == '>'; - - // handle '<' and '>' and '&' - if ( (*line)[i] == '&' ) { - escIndex = i; - continue; - } else if ( escIndex != -1 && (*line)[i] == ';' ) { - TQString esc = line->mid( escIndex, i - escIndex + 1 ); - TQString c; - if ( esc == "<" ) - c = '<'; - else if ( esc == ">" ) - c = '>'; - else if ( esc == "&" ) - c = '&'; - line->replace( escIndex, i - escIndex + 1, c ); - len = line->length(); - i -= i-escIndex; - escIndex = -1; - continue; - } - - if ( state == 0 && tagOpen ) { - state = 1; - startIndex = i; - continue; - } - if ( state == 1 && tagClose ) { - state = 0; - endIndex = i; - if ( startIndex != -1 ) { - int l = (endIndex == -1) ? - line->length() - startIndex : endIndex - startIndex; - line->remove( startIndex, l+1 ); - len = line->length(); - i -= l+1; - } - continue; - } - } -} - -/*! \internal - - Inserts the text into \a line at index \a index. -*/ - -void TQTextEdit::optimInsert(const TQString& text, int line, int index) -{ - if (text.isEmpty() || d->maxLogLines == 0) - return; - if (line < 0) - line = 0; - if (line > d->od->numLines-1) - line = d->od->numLines-1; - if (index < 0) - index = 0; - if (index > (int) d->od->lines[line].length()) - index = d->od->lines[line].length(); - - TQStringList strl = TQStringList::split('\n', text, TRUE); - int numNewLines = (int)strl.count() - 1; - TQTextEditOptimPrivate::Tag *tag = 0; - TQMap<int,TQTextEditOptimPrivate::Tag *>::ConstIterator ii; - int x; - - if (numNewLines == 0) { - // Case 1. Fast single line case - just inject it! - TQString stripped = text; - qStripTags( &stripped ); - d->od->lines[LOGOFFSET(line)].insert(index, stripped); - // move the tag indices following the insertion pt. - if ((ii = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { - tag = *ii; - while (tag && (LOGOFFSET(tag->line) == line && tag->index < index)) - tag = tag->next; - while (tag && (LOGOFFSET(tag->line) == line)) { - tag->index += stripped.length(); - tag = tag->next; - } - } - stripped = text; - optimParseTags(&stripped, line, index); - } else if (numNewLines > 0) { - // Case 2. We have at least 1 newline char - split at - // insertion pt. and make room for new lines - complex and slow! - TQString left = d->od->lines[LOGOFFSET(line)].left(index); - TQString right = d->od->lines[LOGOFFSET(line)].mid(index); - - // rearrange lines for insertion - for (x = d->od->numLines - 1; x > line; x--) - d->od->lines[x + numNewLines] = d->od->lines[x]; - d->od->numLines += numNewLines; - - // fix the tag index and the tag line/index numbers - this - // might take a while.. - for (x = line; x < d->od->numLines; x++) { - if ((ii = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { - tag = ii.data(); - if (LOGOFFSET(tag->line) == line) - while (tag && (LOGOFFSET(tag->line) == line && tag->index < index)) - tag = tag->next; - } - } - - // relabel affected tags with new line numbers and new index - // positions - while (tag) { - if (LOGOFFSET(tag->line) == line) - tag->index -= index; - tag->line += numNewLines; - tag = tag->next; - } - - // generate a new tag index - d->od->tagIndex.clear(); - tag = d->od->tags; - while (tag) { - if (!((ii = d->od->tagIndex.find(LOGOFFSET(tag->line))) != d->od->tagIndex.end())) - d->od->tagIndex[LOGOFFSET(tag->line)] = tag; - tag = tag->next; - } - - // update the tag indices on the spliced line - needs to be done before new tags are added - TQString stripped = strl[strl.count() - 1]; - qStripTags(&stripped); - if ((ii = d->od->tagIndex.find(LOGOFFSET(line + numNewLines))) != d->od->tagIndex.end()) { - tag = *ii; - while (tag && (LOGOFFSET(tag->line) == line + numNewLines)) { - tag->index += stripped.length(); - tag = tag->next; - } - } - - // inject the new lines - TQStringList::Iterator it = strl.begin(); - x = line; - int idx; - for (; it != strl.end(); ++it) { - stripped = *it; - qStripTags(&stripped); - if (x == line) { - stripped = left + stripped; - idx = index; - } else { - idx = 0; - } - d->od->lines[LOGOFFSET(x)] = stripped; - optimParseTags(&*it, x++, idx); - } - d->od->lines[LOGOFFSET(x - 1)] += right; - } - // recalculate the pixel width of the longest injected line - - TQFontMetrics fm(TQScrollView::font()); - int lWidth = 0; - - for (x = line; x < line + numNewLines; x++) { - if (optimHasBoldMetrics(x)) { - TQFont fnt = TQScrollView::font(); - fnt.setBold(TRUE); - fm = TQFontMetrics(fnt); - } - lWidth = fm.width(d->od->lines[x]) + 4; - if (lWidth > d->od->maxLineWidth) - d->od->maxLineWidth = lWidth; - } - resizeContents(d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1); - repaintContents(); - emit textChanged(); -} - - - -/*! \internal - - Returns the first open left-tag appearing before line \a line. - */ -TQTextEditOptimPrivate::Tag * TQTextEdit::optimPreviousLeftTag( int line ) -{ - TQTextEditOptimPrivate::Tag * ftag = 0; - TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; - if ( (it = d->od->tagIndex.find( LOGOFFSET(line) )) != d->od->tagIndex.end() ) - ftag = it.data(); - if ( !ftag ) { - // start searching for an open tag - ftag = d->od->tags; - while ( ftag ) { - if ( ftag->line > line || ftag->next == 0 ) { - if ( ftag->line > line ) - ftag = ftag->prev; - break; - } - ftag = ftag->next; - } - } else { - ftag = ftag->prev; - } - - if ( ftag ) { - if ( ftag && ftag->parent ) // use the open parent tag - ftag = ftag->parent; - else if ( ftag && ftag->leftTag ) // this is a right-tag with no parent - ftag = 0; - } - return ftag; -} - -/*! \internal - - Set the format for the string starting at index \a start and ending - at \a end according to \a tag. If \a tag is a Format tag, find the - first open color tag appearing before \a tag and use that tag to - color the string. -*/ -void TQTextEdit::optimSetTextFormat( TQTextDocument * td, TQTextCursor * cur, - TQTextFormat * f, int start, int end, - TQTextEditOptimPrivate::Tag * tag ) -{ - int formatFlags = TQTextFormat::Bold | TQTextFormat::Italic | - TQTextFormat::Underline; - cur->setIndex( start ); - td->setSelectionStart( 0, *cur ); - cur->setIndex( end ); - td->setSelectionEnd( 0, *cur ); - TQStyleSheetItem * ssItem = styleSheet()->item( tag->tag ); - if ( !ssItem || tag->type == TQTextEditOptimPrivate::Format ) { - f->setBold( tag->bold ); - f->setItalic( tag->italic ); - f->setUnderline( tag->underline ); - if ( tag->type == TQTextEditOptimPrivate::Format ) { - // check to see if there are any open color tags prior to - // this format tag - tag = tag->prev; - while ( tag && (tag->type == TQTextEditOptimPrivate::Format || - tag->leftTag) ) { - tag = tag->leftTag ? tag->parent : tag->prev; - } - } - if ( tag ) { - TQString col = tag->tag.simplifyWhiteSpace(); - if ( col.left( 10 ) == "font color" ) { - int i = col.find( '=', 10 ); - col = col.mid( i + 1 ).simplifyWhiteSpace(); - if ( col[0] == '\"' ) - col = col.mid( 1, col.length() - 2 ); - } - TQColor color = TQColor( col ); - if ( color.isValid() ) { - formatFlags |= TQTextFormat::Color; - f->setColor( color ); - } - } - } else { // use the stylesheet tag definition - if ( ssItem->color().isValid() ) { - formatFlags |= TQTextFormat::Color; - f->setColor( ssItem->color() ); - } - f->setBold( ssItem->fontWeight() == TQFont::Bold ); - f->setItalic( ssItem->fontItalic() ); - f->setUnderline( ssItem->fontUnderline() ); - } - td->setFormat( 0, f, formatFlags ); - td->removeSelection( 0 ); -} - -/*! \internal */ -void TQTextEdit::optimDrawContents( TQPainter * p, int clipx, int clipy, - int clipw, int cliph ) -{ - TQFontMetrics fm( TQScrollView::font() ); - int startLine = clipy / fm.lineSpacing(); - - // we always have to fetch at least two lines for drawing because the - // painter may be translated so that parts of two lines cover the area - // of a single line - int nLines = (cliph / fm.lineSpacing()) + 2; - int endLine = startLine + nLines; - - if ( startLine >= d->od->numLines ) - return; - if ( (startLine + nLines) > d->od->numLines ) - nLines = d->od->numLines - startLine; - - int i = 0; - TQString str; - for ( i = startLine; i < (startLine + nLines); i++ ) - str.append( d->od->lines[ LOGOFFSET(i) ] + "\n" ); - - TQTextDocument * td = new TQTextDocument( 0 ); - td->setDefaultFormat( TQScrollView::font(), TQColor() ); - td->setPlainText( str ); - td->setFormatter( new TQTextFormatterBreakWords ); // deleted by TQTextDoc - td->formatter()->setWrapEnabled( FALSE ); - td->setTabStops(doc->tabStopWidth()); - - // get the current text color from the current format - td->selectAll( TQTextDocument::Standard ); - TQTextFormat f; - f.setColor( colorGroup().text() ); - f.setFont( TQScrollView::font() ); - td->setFormat( TQTextDocument::Standard, &f, - TQTextFormat::Color | TQTextFormat::Font ); - td->removeSelection( TQTextDocument::Standard ); - - // add tag formatting - if ( d->od->tags ) { - int i = startLine; - TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; - TQTextEditOptimPrivate::Tag * tag = 0, * tmp = 0; - TQTextCursor cur( td ); - // Step 1 - find previous left-tag - tmp = optimPreviousLeftTag( i ); - for ( ; i < startLine + nLines; i++ ) { - if ( (it = d->od->tagIndex.find( LOGOFFSET(i) )) != d->od->tagIndex.end() ) - tag = it.data(); - // Step 2 - iterate over tags on the current line - int lastIndex = 0; - while ( tag && tag->line == i ) { - tmp = 0; - if ( tag->prev && !tag->prev->leftTag ) { - tmp = tag->prev; - } else if ( tag->prev && tag->prev->parent ) { - tmp = tag->prev->parent; - } - if ( (tag->index - lastIndex) > 0 && tmp ) { - optimSetTextFormat( td, &cur, &f, lastIndex, tag->index, tmp ); - } - lastIndex = tag->index; - tmp = tag; - tag = tag->next; - } - // Step 3 - color last part of the line - if necessary - if ( tmp && tmp->parent ) - tmp = tmp->parent; - if ( (cur.paragraph()->length()-1 - lastIndex) > 0 && tmp && !tmp->leftTag ) { - optimSetTextFormat( td, &cur, &f, lastIndex, - cur.paragraph()->length() - 1, tmp ); - } - cur.setParagraph( cur.paragraph()->next() ); - } - // useful debug info - // -// tag = d->od->tags; -// tqWarning("###"); -// while ( tag ) { -// tqWarning( "Tag: %p, parent: %09p, leftTag: %09p, Name: %-15s, ParentName: %s, %d%d%d", tag, -// tag->parent, tag->leftTag, tag->tag.latin1(), tag->parent ? tag->parent->tag.latin1():"<none>", -// tag->bold, tag->italic, tag->underline ); -// tag = tag->next; -// } - } - - // if there is a selection, make sure that the selection in the - // part we need to redraw is set correctly - if ( optimHasSelection() ) { - TQTextCursor c1( td ); - TQTextCursor c2( td ); - int selStart = d->od->selStart.line; - int idxStart = d->od->selStart.index; - int selEnd = d->od->selEnd.line; - int idxEnd = d->od->selEnd.index; - if ( selEnd < selStart ) { - tqSwap( &selStart, &selEnd ); - tqSwap( &idxStart, &idxEnd ); - } - if ( selEnd > d->od->numLines-1 ) { - selEnd = d->od->numLines-1; - } - if ( startLine <= selStart && endLine >= selEnd ) { - // case 1: area to paint covers entire selection - int paragS = selStart - startLine; - int paragE = paragS + (selEnd - selStart); - TQTextParagraph * parag = td->paragAt( paragS ); - if ( parag ) { - c1.setParagraph( parag ); - if ( td->text( paragS ).length() >= (uint) idxStart ) - c1.setIndex( idxStart ); - } - parag = td->paragAt( paragE ); - if ( parag ) { - c2.setParagraph( parag ); - if ( td->text( paragE ).length() >= (uint) idxEnd ) - c2.setIndex( idxEnd ); - } - } else if ( startLine > selStart && endLine < selEnd ) { - // case 2: area to paint is all part of the selection - td->selectAll( TQTextDocument::Standard ); - } else if ( startLine > selStart && endLine >= selEnd && - startLine <= selEnd ) { - // case 3: area to paint starts inside a selection, ends past it - c1.setParagraph( td->firstParagraph() ); - c1.setIndex( 0 ); - int paragE = selEnd - startLine; - TQTextParagraph * parag = td->paragAt( paragE ); - if ( parag ) { - c2.setParagraph( parag ); - if ( td->text( paragE ).length() >= (uint) idxEnd ) - c2.setIndex( idxEnd ); - } - } else if ( startLine <= selStart && endLine < selEnd && - endLine > selStart ) { - // case 4: area to paint starts before a selection, ends inside it - int paragS = selStart - startLine; - TQTextParagraph * parag = td->paragAt( paragS ); - if ( parag ) { - c1.setParagraph( parag ); - c1.setIndex( idxStart ); - } - c2.setParagraph( td->lastParagraph() ); - c2.setIndex( td->lastParagraph()->string()->toString().length() - 1 ); - - } - // previously selected? - if ( !td->hasSelection( TQTextDocument::Standard ) ) { - td->setSelectionStart( TQTextDocument::Standard, c1 ); - td->setSelectionEnd( TQTextDocument::Standard, c2 ); - } - } - td->doLayout( p, contentsWidth() ); - - // have to align the painter so that partly visible lines are - // drawn at the correct position within the area that needs to be - // painted - int offset = clipy % fm.lineSpacing() + 2; - TQRect r( clipx, 0, clipw, cliph + offset ); - p->translate( 0, clipy - offset ); - td->draw( p, r.x(), r.y(), r.width(), r.height(), colorGroup() ); - p->translate( 0, -(clipy - offset) ); - delete td; -} - -/*! \internal */ -void TQTextEdit::optimMousePressEvent( TQMouseEvent * e ) -{ - if ( e->button() != LeftButton ) - return; - - TQFontMetrics fm( TQScrollView::font() ); - mousePressed = TRUE; - mousePos = e->pos(); - d->od->selStart.line = e->y() / fm.lineSpacing(); - if ( d->od->selStart.line > d->od->numLines-1 ) { - d->od->selStart.line = d->od->numLines-1; - d->od->selStart.index = d->od->lines[ LOGOFFSET(d->od->numLines-1) ].length(); - } else { - TQString str = d->od->lines[ LOGOFFSET(d->od->selStart.line) ]; - d->od->selStart.index = optimCharIndex( str, mousePos.x() ); - } - d->od->selEnd.line = d->od->selStart.line; - d->od->selEnd.index = d->od->selStart.index; - oldMousePos = e->pos(); - repaintContents( FALSE ); -} - -/*! \internal */ -void TQTextEdit::optimMouseReleaseEvent( TQMouseEvent * e ) -{ - if ( e->button() != LeftButton ) - return; - - if ( scrollTimer->isActive() ) - scrollTimer->stop(); - if ( !inDoubleClick ) { - TQFontMetrics fm( TQScrollView::font() ); - d->od->selEnd.line = e->y() / fm.lineSpacing(); - if ( d->od->selEnd.line > d->od->numLines-1 ) { - d->od->selEnd.line = d->od->numLines-1; - } - TQString str = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ]; - mousePos = e->pos(); - d->od->selEnd.index = optimCharIndex( str, mousePos.x() ); - if ( d->od->selEnd.line < d->od->selStart.line ) { - tqSwap( &d->od->selStart.line, &d->od->selEnd.line ); - tqSwap( &d->od->selStart.index, &d->od->selEnd.index ); - } else if ( d->od->selStart.line == d->od->selEnd.line && - d->od->selStart.index > d->od->selEnd.index ) { - tqSwap( &d->od->selStart.index, &d->od->selEnd.index ); - } - oldMousePos = e->pos(); - repaintContents( FALSE ); - } - if ( mousePressed ) { - mousePressed = FALSE; - copyToClipboard(); - } - - inDoubleClick = FALSE; - emit copyAvailable( optimHasSelection() ); - emit selectionChanged(); -} - -/*! \internal */ -void TQTextEdit::optimMouseMoveEvent( TQMouseEvent * e ) -{ - mousePos = e->pos(); - optimDoAutoScroll(); - oldMousePos = mousePos; -} - -/*! \internal */ -void TQTextEdit::optimDoAutoScroll() -{ - if ( !mousePressed ) - return; - - TQFontMetrics fm( TQScrollView::font() ); - TQPoint pos( mapFromGlobal( TQCursor::pos() ) ); - bool doScroll = FALSE; - int xx = contentsX() + pos.x(); - int yy = contentsY() + pos.y(); - - // find out how much we have to scroll in either dir. - if ( pos.x() < 0 || pos.x() > viewport()->width() || - pos.y() < 0 || pos.y() > viewport()->height() ) { - int my = yy; - if ( pos.x() < 0 ) - xx = contentsX() - fm.width( 'w'); - else if ( pos.x() > viewport()->width() ) - xx = contentsX() + viewport()->width() + fm.width('w'); - - if ( pos.y() < 0 ) { - my = contentsY() - 1; - yy = (my / fm.lineSpacing()) * fm.lineSpacing() + 1; - } else if ( pos.y() > viewport()->height() ) { - my = contentsY() + viewport()->height() + 1; - yy = (my / fm.lineSpacing() + 1) * fm.lineSpacing() - 1; - } - d->od->selEnd.line = my / fm.lineSpacing(); - mousePos.setX( xx ); - mousePos.setY( my ); - doScroll = TRUE; - } else { - d->od->selEnd.line = mousePos.y() / fm.lineSpacing(); - } - - if ( d->od->selEnd.line < 0 ) { - d->od->selEnd.line = 0; - } else if ( d->od->selEnd.line > d->od->numLines-1 ) { - d->od->selEnd.line = d->od->numLines-1; - } - - TQString str = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ]; - d->od->selEnd.index = optimCharIndex( str, mousePos.x() ); - - // have to have a valid index before generating a paint event - if ( doScroll ) - ensureVisible( xx, yy, 1, 1 ); - - // if the text document is smaller than the height of the viewport - // - redraw the whole thing otherwise calculate the rect that - // needs drawing. - if ( d->od->numLines * fm.lineSpacing() < viewport()->height() ) { - repaintContents( contentsX(), contentsY(), width(), height(), FALSE ); - } else { - int h = TQABS(mousePos.y() - oldMousePos.y()) + fm.lineSpacing() * 2; - int y; - if ( oldMousePos.y() < mousePos.y() ) { - y = oldMousePos.y() - fm.lineSpacing(); - } else { - // expand paint area for a fully selected line - h += fm.lineSpacing(); - y = mousePos.y() - fm.lineSpacing()*2; - } - if ( y < 0 ) - y = 0; - repaintContents( contentsX(), y, width(), h, FALSE ); - } - - if ( (!scrollTimer->isActive() && pos.y() < 0) || pos.y() > height() ) - scrollTimer->start( 100, FALSE ); - else if ( scrollTimer->isActive() && pos.y() >= 0 && pos.y() <= height() ) - scrollTimer->stop(); -} - -/*! \internal - - Returns the index of the character in the string \a str that is - currently under the mouse pointer. -*/ -int TQTextEdit::optimCharIndex( const TQString &str, int mx ) const -{ - TQFontMetrics fm(TQScrollView::font()); - uint i = 0; - int dd, dist = 10000000; - int curpos = 0; - int strWidth; - mx = mx - 4; // ### get the real margin from somewhere - - if (!str.contains('\t') && mx > fm.width(str)) - return str.length(); - - while (i < str.length()) { - strWidth = qStrWidth(str.left(i), tabStopWidth(), fm); - dd = strWidth - mx; - if (TQABS(dd) <= dist) { - dist = TQABS(dd); - if (mx >= strWidth) - curpos = i; - } - ++i; - } - return curpos; -} - -/*! \internal */ -void TQTextEdit::optimSelectAll() -{ - d->od->selStart.line = d->od->selStart.index = 0; - d->od->selEnd.line = d->od->numLines - 1; - d->od->selEnd.index = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ].length(); - - repaintContents( FALSE ); - emit copyAvailable( optimHasSelection() ); - emit selectionChanged(); -} - -/*! \internal */ -void TQTextEdit::optimRemoveSelection() -{ - d->od->selStart.line = d->od->selEnd.line = -1; - d->od->selStart.index = d->od->selEnd.index = -1; - repaintContents( FALSE ); -} - -/*! \internal */ -void TQTextEdit::optimSetSelection( int startLine, int startIdx, - int endLine, int endIdx ) -{ - d->od->selStart.line = startLine; - d->od->selEnd.line = endLine; - d->od->selStart.index = startIdx; - d->od->selEnd.index = endIdx; -} - -/*! \internal */ -bool TQTextEdit::optimHasSelection() const -{ - if ( d->od->selStart.line != d->od->selEnd.line || - d->od->selStart.index != d->od->selEnd.index ) - return TRUE; - return FALSE; -} - -/*! \internal */ -TQString TQTextEdit::optimSelectedText() const -{ - TQString str; - - if ( !optimHasSelection() ) - return str; - - // concatenate all strings - if ( d->od->selStart.line == d->od->selEnd.line ) { - str = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ].mid( d->od->selStart.index, - d->od->selEnd.index - d->od->selStart.index ); - } else { - int i = d->od->selStart.line; - str = d->od->lines[ LOGOFFSET(i) ].right( d->od->lines[ LOGOFFSET(i) ].length() - - d->od->selStart.index ) + "\n"; - i++; - for ( ; i < d->od->selEnd.line; i++ ) { - if ( d->od->lines[ LOGOFFSET(i) ].isEmpty() ) // CR lines are empty - str += "\n"; - else - str += d->od->lines[ LOGOFFSET(i) ] + "\n"; - } - str += d->od->lines[ LOGOFFSET(d->od->selEnd.line) ].left( d->od->selEnd.index ); - } - return str; -} - -/*! \internal */ -bool TQTextEdit::optimFind( const TQString & expr, bool cs, bool /*wo*/, - bool fw, int * para, int * index ) -{ - bool found = FALSE; - int parag = para ? *para : d->od->search.line, - idx = index ? *index : d->od->search.index, i; - - if ( d->od->len == 0 ) - return FALSE; - - for ( i = parag; fw ? i < d->od->numLines : i >= 0; fw ? i++ : i-- ) { - idx = fw ? d->od->lines[ LOGOFFSET(i) ].find( expr, idx, cs ) : - d->od->lines[ LOGOFFSET(i) ].findRev( expr, idx, cs ); - if ( idx != -1 ) { - found = TRUE; - break; - } else if ( fw ) - idx = 0; - } - - if ( found ) { - if ( index ) - *index = idx; - if ( para ) - *para = i; - d->od->search.index = idx + 1; - d->od->search.line = i; - optimSetSelection( i, idx, i, idx + expr.length() ); - TQFontMetrics fm( TQScrollView::font() ); - int h = fm.lineSpacing(); - int x = fm.width( d->od->lines[ LOGOFFSET(i) ].left( idx + expr.length()) ) + 4; - ensureVisible( x, i * h + h / 2, 1, h / 2 + 2 ); - repaintContents(); // could possibly be optimized - } - return found; -} - -/*! \reimp */ -void TQTextEdit::polish() -{ - // this will ensure that the last line is visible if text have - // been added to the widget before it is shown - if ( d->optimMode ) - scrollToBottom(); - TQWidget::polish(); -} - -/*! - Sets the maximum number of lines a TQTextEdit can hold in \c - LogText mode to \a limit. If \a limit is -1 (the default), this - signifies an unlimited number of lines. - - \warning Never use formatting tags that span more than one line - when the maximum log lines is set. When lines are removed from the - top of the buffer it could result in an unbalanced tag pair, i.e. - the left formatting tag is removed before the right one. - */ -void TQTextEdit::setMaxLogLines( int limit ) -{ - d->maxLogLines = limit; - if ( d->maxLogLines < -1 ) - d->maxLogLines = -1; - if ( d->maxLogLines == -1 ) - d->logOffset = 0; -} - -/*! - Returns the maximum number of lines TQTextEdit can hold in \c - LogText mode. By default the number of lines is unlimited, which - is signified by a value of -1. - */ -int TQTextEdit::maxLogLines() -{ - return d->maxLogLines; -} - -/*! - Check if the number of lines in the buffer is limited, and uphold - that limit when appending new lines. - */ -void TQTextEdit::optimCheckLimit( const TQString& str ) -{ - if ( d->maxLogLines > -1 && d->maxLogLines <= d->od->numLines ) { - // NB! Removing the top line in the buffer will potentially - // destroy the structure holding the formatting tags - if line - // spanning tags are used. - TQTextEditOptimPrivate::Tag *t = d->od->tags, *tmp, *itr; - TQPtrList<TQTextEditOptimPrivate::Tag> lst; - while ( t ) { - t->line -= 1; - // unhook the ptr from the tag structure - if ( ((uint) LOGOFFSET(t->line) < (uint) d->logOffset && - (uint) LOGOFFSET(t->line) < (uint) LOGOFFSET(d->od->numLines) && - (uint) LOGOFFSET(d->od->numLines) > (uint) d->logOffset) ) - { - if ( t->prev ) - t->prev->next = t->next; - if ( t->next ) - t->next->prev = t->prev; - if ( d->od->tags == t ) - d->od->tags = t->next; - if ( d->od->lastTag == t ) { - if ( t->prev ) - d->od->lastTag = t->prev; - else - d->od->lastTag = d->od->tags; - } - tmp = t; - t = t->next; - lst.append( tmp ); - delete tmp; - } else { - t = t->next; - } - } - // Remove all references to the ptrs we just deleted - itr = d->od->tags; - while ( itr ){ - for ( tmp = lst.first(); tmp; tmp = lst.next() ) { - if ( itr->parent == tmp ) - itr->parent = 0; - if ( itr->leftTag == tmp ) - itr->leftTag = 0; - } - itr = itr->next; - } - // ...in the tag index as well - TQMapIterator<int, TQTextEditOptimPrivate::Tag *> idx; - if ( (idx = d->od->tagIndex.find( d->logOffset )) != d->od->tagIndex.end() ) - d->od->tagIndex.remove( idx ); - - TQMapIterator<int,TQString> it; - if ( (it = d->od->lines.find( d->logOffset )) != d->od->lines.end() ) { - d->od->len -= (*it).length(); - d->od->lines.remove( it ); - d->od->numLines--; - d->logOffset = LOGOFFSET(1); - } - } - d->od->len += str.length(); - d->od->lines[ LOGOFFSET(d->od->numLines++) ] = str; -} - -#endif // QT_TEXTEDIT_OPTIMIZATION - -/*! - \property TQTextEdit::autoFormatting - \brief the enabled set of auto formatting features - - The value can be any combination of the values in the \c - AutoFormatting enum. The default is \c AutoAll. Choose \c AutoNone - to disable all automatic formatting. - - Currently, the only automatic formatting feature provided is \c - AutoBulletList; future versions of TQt may offer more. -*/ - -void TQTextEdit::setAutoFormatting( uint features ) -{ - d->autoFormatting = features; -} - -uint TQTextEdit::autoFormatting() const -{ - return d->autoFormatting; -} - -/*! - Returns the TQSyntaxHighlighter set on this TQTextEdit. 0 is - returned if no syntax highlighter is set. - */ -TQSyntaxHighlighter * TQTextEdit::syntaxHighlighter() const -{ - if (document()->preProcessor()) - return ((TQSyntaxHighlighterInternal *) document()->preProcessor())->highlighter; - else - return 0; -} - -#endif //TQT_NO_TEXTEDIT diff --git a/src/widgets/qtextview.cpp b/src/widgets/qtextview.cpp deleted file mode 100644 index b672bee3..00000000 --- a/src/widgets/qtextview.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Implementation of the TQTextView class -** -** Created : 990101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqtextview.h" - -#ifndef TQT_NO_TEXTVIEW - -/*! \class TQTextView - \brief The TQTextView class provides a rich-text viewer. - - \obsolete - - This class wraps a read-only \l TQTextEdit. - Use a \l TQTextEdit instead, and call setReadOnly(TRUE) - to disable editing. -*/ - -/*! \reimp */ - -TQTextView::TQTextView( const TQString& text, const TQString& context, - TQWidget *parent, const char *name ) - : TQTextEdit( text, context, parent, name ) -{ - setReadOnly( TRUE ); -} - -/*! \reimp */ - -TQTextView::TQTextView( TQWidget *parent, const char *name ) - : TQTextEdit( parent, name ) -{ - setReadOnly( TRUE ); -} - -/*! \reimp */ - -TQTextView::~TQTextView() -{ -} - -/*! - \property TQTextView::undoDepth - \brief the number of undoable steps -*/ - -/*! - \property TQTextView::overwriteMode - \brief whether new text overwrites or pushes aside existing text -*/ - -/*! - \property TQTextView::modified - \brief Whether the text view's contents have been modified. -*/ - -/*! - \property TQTextView::readOnly - \brief Whether the text view's contents are read only. -*/ - -/*! - \property TQTextView::undoRedoEnabled - \brief Whether undo and redo are enabled. -*/ - -#endif diff --git a/src/widgets/tqtextbrowser.cpp b/src/widgets/tqtextbrowser.cpp new file mode 100644 index 00000000..dfafb32c --- /dev/null +++ b/src/widgets/tqtextbrowser.cpp @@ -0,0 +1,555 @@ +/**************************************************************************** +** +** Implementation of the TQTextBrowser class +** +** Created : 990101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextbrowser.h" +#ifndef TQT_NO_TEXTBROWSER +#include "../kernel/qrichtext_p.h" + +#include "ntqapplication.h" +#include "ntqlayout.h" +#include "ntqpainter.h" + +#include "tqvaluestack.h" +#include "stdio.h" +#include "ntqfile.h" +#include "tqtextstream.h" +#include "ntqlayout.h" +#include "ntqbitmap.h" +#include "ntqtimer.h" +#include "tqimage.h" +#include "ntqsimplerichtext.h" +#include "ntqdragobject.h" +#include "ntqurl.h" +#include "ntqcursor.h" + +/*! + \class TQTextBrowser tqtextbrowser.h + \brief The TQTextBrowser class provides a rich text browser with hypertext navigation. + + \ingroup advanced + \ingroup helpsystem + \ingroup text + \mainclass + + This class extends TQTextEdit (in read-only mode), adding some + navigation functionality so that users can follow links in + hypertext documents. The contents of TQTextEdit is set with + setText(), but TQTextBrowser has an additional function, + setSource(), which makes it possible to set the text to a named + document. The name is looked up in the text view's mime source + factory. If a document name ends with an anchor (for example, "\c + #anchor"), the text browser automatically scrolls to that position + (using scrollToAnchor()). When the user clicks on a hyperlink, the + browser will call setSource() itself, with the link's \c href + value as argument. You can track the current source by connetion + to the sourceChanged() signal. + + TQTextBrowser provides backward() and forward() slots which you can + use to implement Back and Forward buttons. The home() slot sets + the text to the very first document displayed. The linkClicked() + signal is emitted when the user clicks a link. + + By using TQTextEdit::setMimeSourceFactory() you can provide your + own subclass of TQMimeSourceFactory. This makes it possible to + access data from anywhere, for example from a network or from a + database. See TQMimeSourceFactory::data() for details. + + If you intend using the mime factory to read the data directly + from the file system, you may have to specify the encoding for the + file extension you are using. For example: + \code + mimeSourceFactory()->setExtensionType("qml", "text/utf8"); + \endcode + This is to ensure that the factory is able to resolve the document + names. + + TQTextBrowser interprets the tags it processes in accordance with + the default style sheet. Change the style sheet with + \l{setStyleSheet()}; see TQStyleSheet for details. + + If you want to provide your users with editable rich text use + TQTextEdit. If you want a text browser without hypertext navigation + use TQTextEdit, and use TQTextEdit::setReadOnly() to disable + editing. If you just need to display a small piece of rich text + use TQSimpleRichText or TQLabel. + + <img src=tqtextbrowser-m.png> <img src=tqtextbrowser-w.png> +*/ + +class TQTextBrowserData +{ +public: + TQTextBrowserData():textOrSourceChanged(FALSE) {} + + TQValueStack<TQString> stack; + TQValueStack<TQString> forwardStack; + TQString home; + TQString curmain; + TQString curmark; + + /*flag necessary to give the linkClicked() signal some meaningful + semantics when somebody connected to it calls setText() or + setSource() */ + bool textOrSourceChanged; +}; + + +/*! + Constructs an empty TQTextBrowser called \a name, with parent \a + parent. +*/ +TQTextBrowser::TQTextBrowser(TQWidget *parent, const char *name) + : TQTextEdit( parent, name ) +{ + setReadOnly( TRUE ); + d = new TQTextBrowserData; + + viewport()->setMouseTracking( TRUE ); +} + +/*! + \reimp +*/ +TQTextBrowser::~TQTextBrowser() +{ + delete d; +} + + +/*! + \property TQTextBrowser::source + \brief the name of the displayed document. + + This is a TQString::null if no document is displayed or if the + source is unknown. + + Setting this property uses the mimeSourceFactory() to lookup the + named document. It also checks for optional anchors and scrolls + the document accordingly. + + If the first tag in the document is \c{<qt type=detail>}, the + document is displayed as a popup rather than as new document in + the browser window itself. Otherwise, the document is displayed + normally in the text browser with the text set to the contents of + the named document with setText(). + + If you are using the filesystem access capabilities of the mime + source factory, you must ensure that the factory knows about the + encoding of specified files; otherwise no data will be available. + The default factory handles a couple of common file extensions + such as \c *.html and \c *.txt with reasonable defaults. See + TQMimeSourceFactory::data() for details. +*/ + +TQString TQTextBrowser::source() const +{ + if ( d->stack.isEmpty() ) + return TQString::null; + else + return d->stack.top(); +} + +/*! + \property TQTextBrowser::undoDepth + \brief This text browser's undo depth. +*/ + +/*! + \property TQTextBrowser::overwriteMode + \brief This text browser's overwrite mode. +*/ + +/*! + \property TQTextBrowser::modified + \brief Whether the contents have been modified. +*/ + +/*! + \property TQTextBrowser::readOnly + \brief Whether the contents are read only. +*/ + +/*! + \property TQTextBrowser::undoRedoEnabled + \brief Whether undo and redo are enabled. +*/ + + + +/*! + Reloads the current set source. +*/ + +void TQTextBrowser::reload() +{ + TQString s = d->curmain; + d->curmain = ""; + setSource( s ); +} + + +void TQTextBrowser::setSource(const TQString& name) +{ +#ifndef TQT_NO_CURSOR + if ( isVisible() ) + tqApp->setOverrideCursor( waitCursor ); +#endif + d->textOrSourceChanged = TRUE; + TQString source = name; + TQString mark; + int hash = name.find('#'); + if ( hash != -1) { + source = name.left( hash ); + mark = name.mid( hash+1 ); + } + + if ( source.left(5) == "file:" ) + source = source.mid(6); + + TQString url = mimeSourceFactory()->makeAbsolute( source, context() ); + TQString txt; + bool dosettext = FALSE; + + if ( !source.isEmpty() && url != d->curmain ) { + const TQMimeSource* m = + mimeSourceFactory()->data( source, context() ); + if ( !m ){ + tqWarning("TQTextBrowser: no mimesource for %s", source.latin1() ); + } + else { + if ( !TQTextDrag::decode( m, txt ) ) { + tqWarning("TQTextBrowser: cannot decode %s", source.latin1() ); + } + } + if ( isVisible() ) { + TQString firstTag = txt.left( txt.find( '>' ) + 1 ); + if ( firstTag.left( 3 ) == "<qt" && firstTag.contains( "type" ) && firstTag.contains( "detail" ) ) { + popupDetail( txt, TQCursor::pos() ); +#ifndef TQT_NO_CURSOR + tqApp->restoreOverrideCursor(); +#endif + return; + } + } + + d->curmain = url; + dosettext = TRUE; + } + + d->curmark = mark; + + if ( !mark.isEmpty() ) { + url += "#"; + url += mark; + } + if ( !d->home ) + d->home = url; + + if ( d->stack.isEmpty() || d->stack.top() != url) + d->stack.push( url ); + + int stackCount = (int)d->stack.count(); + if ( d->stack.top() == url ) + stackCount--; + emit backwardAvailable( stackCount > 0 ); + stackCount = (int)d->forwardStack.count(); + if ( d->forwardStack.isEmpty() || d->forwardStack.top() == url ) + stackCount--; + emit forwardAvailable( stackCount > 0 ); + + if ( dosettext ) + TQTextEdit::setText( txt, url ); + + if ( !mark.isEmpty() ) + scrollToAnchor( mark ); + else + setContentsPos( 0, 0 ); + +#ifndef TQT_NO_CURSOR + if ( isVisible() ) + tqApp->restoreOverrideCursor(); +#endif + + emit sourceChanged( url ); +} + +/*! + \fn void TQTextBrowser::backwardAvailable(bool available) + + This signal is emitted when the availability of backward() + changes. \a available is FALSE when the user is at home(); + otherwise it is TRUE. +*/ + +/*! + \fn void TQTextBrowser::forwardAvailable(bool available) + + This signal is emitted when the availability of forward() changes. + \a available is TRUE after the user navigates backward() and FALSE + when the user navigates or goes forward(). +*/ + +/*! + \fn void TQTextBrowser::sourceChanged( const TQString& src) + + This signal is emitted when the mime source has changed, \a src + being the new source. + + Source changes happen both programmatically when calling + setSource(), forward(), backword() or home() or when the user + clicks on links or presses the equivalent key sequences. +*/ + +/*! \fn void TQTextBrowser::highlighted (const TQString &link) + + This signal is emitted when the user has selected but not + activated a link in the document. \a link is the value of the \c + href i.e. the name of the target document. +*/ + +/*! + \fn void TQTextBrowser::linkClicked( const TQString& link) + + This signal is emitted when the user clicks a link. The \a link is + the value of the \c href i.e. the name of the target document. + + The \a link will be the absolute location of the document, based + on the value of the anchor's href tag and the current context of + the document. + + \sa anchorClicked(), context() +*/ + +/*! + \fn void TQTextBrowser::anchorClicked( const TQString& name, const TQString &link) + + This signal is emitted when the user clicks an anchor. The \a link is + the value of the \c href i.e. the name of the target document. The \a name + is the name of the anchor. + + \sa linkClicked() +*/ + +/*! + Changes the document displayed to the previous document in the + list of documents built by navigating links. Does nothing if there + is no previous document. + + \sa forward(), backwardAvailable() +*/ +void TQTextBrowser::backward() +{ + if ( d->stack.count() <= 1) + return; + d->forwardStack.push( d->stack.pop() ); + setSource( d->stack.pop() ); + emit forwardAvailable( TRUE ); +} + +/*! + Changes the document displayed to the next document in the list of + documents built by navigating links. Does nothing if there is no + next document. + + \sa backward(), forwardAvailable() +*/ +void TQTextBrowser::forward() +{ + if ( d->forwardStack.isEmpty() ) + return; + setSource( d->forwardStack.pop() ); + emit forwardAvailable( !d->forwardStack.isEmpty() ); +} + +/*! + Changes the document displayed to be the first document the + browser displayed. +*/ +void TQTextBrowser::home() +{ + if (!d->home.isNull() ) + setSource( d->home ); +} + +/*! + The event \a e is used to provide the following keyboard shortcuts: + \table + \header \i Keypress \i Action + \row \i Alt+Left Arrow \i \l backward() + \row \i Alt+Right Arrow \i \l forward() + \row \i Alt+Up Arrow \i \l home() + \endtable +*/ +void TQTextBrowser::keyPressEvent( TQKeyEvent * e ) +{ + if ( e->state() & AltButton ) { + switch (e->key()) { + case Key_Right: + forward(); + return; + case Key_Left: + backward(); + return; + case Key_Up: + home(); + return; + } + } + TQTextEdit::keyPressEvent(e); +} + +class TQTextDetailPopup : public TQWidget +{ +public: + TQTextDetailPopup() + : TQWidget ( 0, "automatic TQText detail widget", WType_Popup | WDestructiveClose ) + { + } + +protected: + + void mousePressEvent( TQMouseEvent*) + { + close(); + } +}; + + +void TQTextBrowser::popupDetail( const TQString& contents, const TQPoint& pos ) +{ + + const int shadowWidth = 6; // also used as '5' and '6' and even '8' below + const int vMargin = 8; + const int hMargin = 12; + + TQWidget* popup = new TQTextDetailPopup; + popup->setBackgroundMode( TQWidget::NoBackground ); + + TQSimpleRichText* doc = new TQSimpleRichText( contents, popup->font() ); + doc->adjustSize(); + TQRect r( 0, 0, doc->width(), doc->height() ); + + int w = r.width() + 2*hMargin; + int h = r.height() + 2*vMargin; + + popup->resize( w + shadowWidth, h + shadowWidth ); + + // okay, now to find a suitable location + //###### we need a global fancy popup positioning somewhere + popup->move(pos - popup->rect().center()); + if (popup->geometry().right() > TQApplication::desktop()->width()) + popup->move( TQApplication::desktop()->width() - popup->width(), + popup->y() ); + if (popup->geometry().bottom() > TQApplication::desktop()->height()) + popup->move( popup->x(), + TQApplication::desktop()->height() - popup->height() ); + if ( popup->x() < 0 ) + popup->move( 0, popup->y() ); + if ( popup->y() < 0 ) + popup->move( popup->x(), 0 ); + + + popup->show(); + + // now for super-clever shadow stuff. super-clever mostly in + // how many window system problems it skirts around. + + TQPainter p( popup ); + p.setPen( TQApplication::palette().active().foreground() ); + p.drawRect( 0, 0, w, h ); + p.setPen( TQApplication::palette().active().mid() ); + p.setBrush( TQColor( 255, 255, 240 ) ); + p.drawRect( 1, 1, w-2, h-2 ); + p.setPen( black ); + + doc->draw( &p, hMargin, vMargin, r, popup->colorGroup(), 0 ); + delete doc; + + p.drawPoint( w + 5, 6 ); + p.drawLine( w + 3, 6, + w + 5, 8 ); + p.drawLine( w + 1, 6, + w + 5, 10 ); + int i; + for( i=7; i < h; i += 2 ) + p.drawLine( w, i, + w + 5, i + 5 ); + for( i = w - i + h; i > 6; i -= 2 ) + p.drawLine( i, h, + i + 5, h + 5 ); + for( ; i > 0 ; i -= 2 ) + p.drawLine( 6, h + 6 - i, + i + 5, h + 5 ); +} + +/*! + \fn void TQTextBrowser::setText( const TQString &txt ) + + \overload + + Sets the text to \a txt. +*/ + +/*! + \reimp +*/ + +void TQTextBrowser::setText( const TQString &txt, const TQString &context ) +{ + d->textOrSourceChanged = TRUE; + d->curmark = ""; + d->curmain = ""; + TQTextEdit::setText( txt, context ); +} + +void TQTextBrowser::emitHighlighted( const TQString &s ) +{ + emit highlighted( s ); +} + +void TQTextBrowser::emitLinkClicked( const TQString &s ) +{ + d->textOrSourceChanged = FALSE; + emit linkClicked( s ); + if ( !d->textOrSourceChanged ) + setSource( s ); +} + +#endif // TQT_NO_TEXTBROWSER diff --git a/src/widgets/tqtextbrowser.h b/src/widgets/tqtextbrowser.h new file mode 100644 index 00000000..c68031ff --- /dev/null +++ b/src/widgets/tqtextbrowser.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Definition of the TQTextBrowser class +** +** Created : 990101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTBROWSER_H +#define TQTEXTBROWSER_H + +#ifndef QT_H +#include "tqptrlist.h" +#include "ntqpixmap.h" +#include "ntqcolor.h" +#include "tqtextedit.h" +#endif // QT_H + +#ifndef TQT_NO_TEXTBROWSER + +class TQTextBrowserData; + +class TQ_EXPORT TQTextBrowser : public TQTextEdit +{ + TQ_OBJECT + TQ_PROPERTY( TQString source READ source WRITE setSource ) + TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false ) + TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false ) + TQ_OVERRIDE( bool modified SCRIPTABLE false) + TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false ) + TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false ) + +public: + TQTextBrowser( TQWidget* parent=0, const char* name=0 ); + ~TQTextBrowser(); + + TQString source() const; + +public slots: + virtual void setSource(const TQString& name); + virtual void backward(); + virtual void forward(); + virtual void home(); + virtual void reload(); + void setText( const TQString &txt ) { setText( txt, TQString::null ); } + virtual void setText( const TQString &txt, const TQString &context ); + +signals: + void backwardAvailable( bool ); + void forwardAvailable( bool ); + void sourceChanged( const TQString& ); + void highlighted( const TQString& ); + void linkClicked( const TQString& ); + void anchorClicked( const TQString&, const TQString& ); + +protected: + void keyPressEvent( TQKeyEvent * e); + +private: + void popupDetail( const TQString& contents, const TQPoint& pos ); + bool linksEnabled() const { return TRUE; } + void emitHighlighted( const TQString &s ); + void emitLinkClicked( const TQString &s ); + TQTextBrowserData *d; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQTextBrowser( const TQTextBrowser & ); + TQTextBrowser& operator=( const TQTextBrowser & ); +#endif +}; + +#endif // TQT_NO_TEXTBROWSER + +#endif // TQTEXTBROWSER_H diff --git a/src/widgets/tqtextedit.cpp b/src/widgets/tqtextedit.cpp new file mode 100644 index 00000000..a4cc6cf1 --- /dev/null +++ b/src/widgets/tqtextedit.cpp @@ -0,0 +1,7474 @@ +/**************************************************************************** +** +** Implementation of the TQTextEdit class +** +** Created : 990101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextedit.h" + +#ifndef TQT_NO_TEXTEDIT + +// Keep this position to avoid patch rejection +#ifndef TQT_NO_IM +#include "ntqinputcontext.h" +#endif + +#include "../kernel/qrichtext_p.h" +#include "ntqpainter.h" +#include "ntqpen.h" +#include "ntqbrush.h" +#include "ntqpixmap.h" +#include "ntqfont.h" +#include "ntqcolor.h" +#include "ntqstyle.h" +#include "ntqsize.h" +#include "ntqevent.h" +#include "ntqtimer.h" +#include "ntqapplication.h" +#include "ntqlistbox.h" +#include "ntqvbox.h" +#include "ntqapplication.h" +#include "ntqclipboard.h" +#include "ntqcolordialog.h" +#include "ntqfontdialog.h" +#include "ntqstylesheet.h" +#include "ntqdragobject.h" +#include "ntqurl.h" +#include "ntqcursor.h" +#include "ntqregexp.h" +#include "ntqpopupmenu.h" +#include "tqptrstack.h" +#include "ntqmetaobject.h" +#include "tqtextbrowser.h" +#include <private/qucom_p.h> +#include "private/qsyntaxhighlighter_p.h" +#include <ntqguardedptr.h> + +#ifndef TQT_NO_ACCEL +#include <ntqkeysequence.h> +#define ACCEL_KEY(k) "\t" + TQString(TQKeySequence( TQt::CTRL | TQt::Key_ ## k )) +#else +#define ACCEL_KEY(k) "\t" + TQString("Ctrl+" #k) +#endif + +#ifdef QT_TEXTEDIT_OPTIMIZATION +#define LOGOFFSET(i) d->logOffset + i +#endif + +struct TQUndoRedoInfoPrivate +{ + TQTextString text; +}; + +class TQTextEditPrivate +{ +public: + TQTextEditPrivate() + :preeditStart(-1),preeditLength(-1),ensureCursorVisibleInShowEvent(FALSE), + tabChangesFocus(FALSE), +#ifndef TQT_NO_CLIPBOARD + clipboard_mode( TQClipboard::Clipboard ), +#endif +#ifdef QT_TEXTEDIT_OPTIMIZATION + od(0), optimMode(FALSE), + maxLogLines(-1), + logOffset(0), +#endif + autoFormatting( (uint)TQTextEdit::AutoAll ) + { + for ( int i=0; i<7; i++ ) + id[i] = 0; + } + int id[ 7 ]; + int preeditStart; + int preeditLength; + bool composeMode() const { return ( preeditLength > 0 ); } + + uint ensureCursorVisibleInShowEvent : 1; + uint tabChangesFocus : 1; + TQString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized + TQString pressedName; + TQString onName; +#ifndef TQT_NO_CLIPBOARD + TQClipboard::Mode clipboard_mode; +#endif + TQTimer *trippleClickTimer; + TQPoint trippleClickPoint; +#ifdef QT_TEXTEDIT_OPTIMIZATION + TQTextEditOptimPrivate * od; + bool optimMode : 1; + int maxLogLines; + int logOffset; +#endif + uint autoFormatting; +}; + +#ifndef TQT_NO_MIME +class TQRichTextDrag : public TQTextDrag +{ +public: + TQRichTextDrag( TQWidget *dragSource = 0, const char *name = 0 ); + + void setPlainText( const TQString &txt ) { setText( txt ); } + void setRichText( const TQString &txt ) { richTxt = txt; } + + virtual TQByteArray encodedData( const char *mime ) const; + virtual const char* format( int i ) const; + + static bool decode( TQMimeSource *e, TQString &str, const TQCString &mimetype, + const TQCString &subtype ); + static bool canDecode( TQMimeSource* e ); + +private: + TQString richTxt; + +}; + +TQRichTextDrag::TQRichTextDrag( TQWidget *dragSource, const char *name ) + : TQTextDrag( dragSource, name ) +{ +} + +TQByteArray TQRichTextDrag::encodedData( const char *mime ) const +{ + if ( qstrcmp( "application/x-qrichtext", mime ) == 0 ) { + return richTxt.utf8(); // #### perhaps we should use USC2 instead? + } else + return TQTextDrag::encodedData( mime ); +} + +bool TQRichTextDrag::decode( TQMimeSource *e, TQString &str, const TQCString &mimetype, + const TQCString &subtype ) +{ + if ( mimetype == "application/x-qrichtext" ) { + // do richtext decode + const char *mime; + int i; + for ( i = 0; ( mime = e->format( i ) ); ++i ) { + if ( qstrcmp( "application/x-qrichtext", mime ) != 0 ) + continue; + str = TQString::fromUtf8( e->encodedData( mime ) ); + return TRUE; + } + return FALSE; + } + + // do a regular text decode + TQCString subt = subtype; + return TQTextDrag::decode( e, str, subt ); +} + +bool TQRichTextDrag::canDecode( TQMimeSource* e ) +{ + if ( e->provides( "application/x-qrichtext" ) ) + return TRUE; + return TQTextDrag::canDecode( e ); +} + +const char* TQRichTextDrag::format( int i ) const +{ + if ( TQTextDrag::format( i ) ) + return TQTextDrag::format( i ); + if ( TQTextDrag::format( i-1 ) ) + return "application/x-qrichtext"; + return 0; +} + +#endif + +static bool block_set_alignment = FALSE; + +/*! + \class TQTextEdit tqtextedit.h + \brief The TQTextEdit widget provides a powerful single-page rich text editor. + + \ingroup basic + \ingroup text + \mainclass + + \tableofcontents + + \section1 Introduction and Concepts + + TQTextEdit is an advanced WYSIWYG viewer/editor supporting rich + text formatting using HTML-style tags. It is optimized to handle + large documents and to respond quickly to user input. + + TQTextEdit has four modes of operation: + \table + \header \i Mode \i Command \i Notes + \row \i Plain Text Editor \i setTextFormat(PlainText) + \i Set text with setText(); text() returns plain text. Text + attributes (e.g. colors) can be set, but plain text is always + returned. + \row \i Rich Text Editor \i setTextFormat(RichText) + \i Set text with setText(); text() returns rich text. Rich + text editing is fairly limited. You can't set margins or + insert images for example (although you can read and + correctly display files that have margins set and that + include images). This mode is mostly useful for editing small + amounts of rich text. <sup>1.</sup> + \row \i Text Viewer \i setReadOnly(TRUE) + \i Set text with setText() or append() (which has no undo + history so is faster and uses less memory); text() returns + plain or rich text depending on the textFormat(). This mode + can correctly display a large subset of HTML tags. + \row \i Log Viewer \i setTextFormat(LogText) + \i Append text using append(). The widget is set to be read + only and rich text support is disabled although a few HTML + tags (for color, bold, italic and underline) may be used. + (See \link #logtextmode LogText mode\endlink for details.) + \endtable + + <sup>1.</sup><small>A more complete API that supports setting + margins, images, etc., is planned for a later TQt release.</small> + + TQTextEdit can be used as a syntax highlighting editor when used in + conjunction with TQSyntaxHighlighter. + + We recommend that you always call setTextFormat() to set the mode + you want to use. If you use \c AutoText then setText() and + append() will try to determine whether the text they are given is + plain text or rich text. If you use \c RichText then setText() and + append() will assume that the text they are given is rich text. + insert() simply inserts the text it is given. + + TQTextEdit works on paragraphs and characters. A paragraph is a + formatted string which is word-wrapped to fit into the width of + the widget. By default when reading plain text, one newline + signify a paragraph. A document consists of zero or more + paragraphs, indexed from 0. Characters are indexed on a + per-paragraph basis, also indexed from 0. The words in the + paragraph are aligned in accordance with the paragraph's + alignment(). Paragraphs are separated by hard line breaks. Each + character within a paragraph has its own attributes, for example, + font and color. + + The text edit documentation uses the following concepts: + \list + \i \e{current format} -- + this is the format at the current cursor position, \e and it + is the format of the selected text if any. + \i \e{current paragraph} -- the paragraph which contains the + cursor. + \endlist + + TQTextEdit can display images (using TQMimeSourceFactory), lists and + tables. If the text is too large to view within the text edit's + viewport, scrollbars will appear. The text edit can load both + plain text and HTML files (a subset of HTML 3.2 and 4). The + rendering style and the set of valid tags are defined by a + styleSheet(). Custom tags can be created and placed in a custom + style sheet. Change the style sheet with \l{setStyleSheet()}; see + TQStyleSheet for details. The images identified by image tags are + displayed if they can be interpreted using the text edit's + \l{TQMimeSourceFactory}; see setMimeSourceFactory(). + + If you want a text browser with more navigation use TQTextBrowser. + If you just need to display a small piece of rich text use TQLabel + or TQSimpleRichText. + + If you create a new TQTextEdit, and want to allow the user to edit + rich text, call setTextFormat(TQt::RichText) to ensure that the + text is treated as rich text. (Rich text uses HTML tags to set + text formatting attributes. See TQStyleSheet for information on the + HTML tags that are supported.). If you don't call setTextFormat() + explicitly the text edit will guess from the text itself whether + it is rich text or plain text. This means that if the text looks + like HTML or XML it will probably be interpreted as rich text, so + you should call setTextFormat(TQt::PlainText) to preserve such + text. + + Note that we do not intend to add a full-featured web browser + widget to TQt (because that would easily double TQt's size and only + a few applications would benefit from it). The rich + text support in TQt is designed to provide a fast, portable and + efficient way to add reasonable online help facilities to + applications, and to provide a basis for rich text editors. + + \section1 Using TQTextEdit as a Display Widget + + TQTextEdit can display a large HTML subset, including tables and + images. + + The text is set or replaced using setText() which deletes any + existing text and replaces it with the text passed in the + setText() call. If you call setText() with legacy HTML (with + setTextFormat(RichText) in force), and then call text(), the text + that is returned may have different markup, but will render the + same. Text can be inserted with insert(), paste(), pasteSubType() + and append(). Text that is appended does not go into the undo + history; this makes append() faster and consumes less memory. Text + can also be cut(). The entire text is deleted with clear() and the + selected text is deleted with removeSelectedText(). Selected + (marked) text can also be deleted with del() (which will delete + the character to the right of the cursor if no text is selected). + + Loading and saving text is achieved using setText() and text(), + for example: + \code + TQFile file( fileName ); // Read the text from a file + if ( file.open( IO_ReadOnly ) ) { + TQTextStream stream( &file ); + textEdit->setText( stream.read() ); + } + + TQFile file( fileName ); // Write the text to a file + if ( file.open( IO_WriteOnly ) ) { + TQTextStream stream( &file ); + stream << textEdit->text(); + textEdit->setModified( FALSE ); + } + \endcode + + By default the text edit wraps words at whitespace to fit within + the text edit widget. The setWordWrap() function is used to + specify the kind of word wrap you want, or \c NoWrap if you don't + want any wrapping. Call setWordWrap() to set a fixed pixel width + \c FixedPixelWidth, or character column (e.g. 80 column) \c + FixedColumnWidth with the pixels or columns specified with + setWrapColumnOrWidth(). If you use word wrap to the widget's width + \c WidgetWidth, you can specify whether to break on whitespace or + anywhere with setWrapPolicy(). + + The background color is set differently than other widgets, using + setPaper(). You specify a brush style which could be a plain color + or a complex pixmap. + + Hypertext links are automatically underlined; this can be changed + with setLinkUnderline(). The tab stop width is set with + setTabStopWidth(). + + The zoomIn() and zoomOut() functions can be used to resize the + text by increasing (decreasing for zoomOut()) the point size used. + Images are not affected by the zoom functions. + + The lines() function returns the number of lines in the text and + paragraphs() returns the number of paragraphs. The number of lines + within a particular paragraph is returned by linesOfParagraph(). + The length of the entire text in characters is returned by + length(). + + You can scroll to an anchor in the text, e.g. + \c{<a name="anchor">} with scrollToAnchor(). The find() function + can be used to find and select a given string within the text. + + A read-only TQTextEdit provides the same functionality as the + (obsolete) TQTextView. (TQTextView is still supplied for + compatibility with old code.) + + \section2 Read-only key bindings + + When TQTextEdit is used read-only the key-bindings are limited to + navigation, and text may only be selected with the mouse: + \table + \header \i Keypresses \i Action + \row \i UpArrow \i Move one line up + \row \i DownArrow \i Move one line down + \row \i LeftArrow \i Move one character left + \row \i RightArrow \i Move one character right + \row \i PageUp \i Move one (viewport) page up + \row \i PageDown \i Move one (viewport) page down + \row \i Home \i Move to the beginning of the text + \row \i End \i Move to the end of the text + \row \i Shift+Wheel + \i Scroll the page horizontally (the Wheel is the mouse wheel) + \row \i Ctrl+Wheel \i Zoom the text + \endtable + + The text edit may be able to provide some meta-information. For + example, the documentTitle() function will return the text from + within HTML \c{<title>} tags. + + The text displayed in a text edit has a \e context. The context is + a path which the text edit's TQMimeSourceFactory uses to resolve + the locations of files and images. It is passed to the + mimeSourceFactory() when quering data. (See TQTextEdit() and + \l{context()}.) + + \target logtextmode + \section2 Using TQTextEdit in LogText Mode + + Setting the text format to \c LogText puts the widget in a special + mode which is optimized for very large texts. Editing, word wrap, + and rich text support are disabled in this mode (the widget is + explicitly made read-only). This allows the text to be stored in a + different, more memory efficient manner. However, a certain degree + of text formatting is supported through the use of formatting tags. + A tag is delimited by \c < and \c {>}. The characters \c {<}, \c > + and \c & are escaped by using \c {<}, \c {>} and \c {&}. + A tag pair consists of a left and a right tag (or open/close tags). + Left-tags mark the starting point for formatting, while right-tags + mark the ending point. A right-tag always start with a \c / before + the tag keyword. For example \c <b> and \c </b> are a tag pair. + Tags can be nested, but they have to be closed in the same order as + they are opened. For example, \c <b><u></u></b> is valid, while \c + <b><u></b></u> will output an error message. + + By using tags it is possible to change the color, bold, italic and + underline settings for a piece of text. A color can be specified + by using the HTML font tag \c {<font color=colorname>}. The color + name can be one of the color names from the X11 color database, or + a RGB hex value (e.g \c {#00ff00}). Example of valid color tags: + \c {<font color=red>}, \c {<font color="light blue">}, \c {<font + color="#223344">}. Bold, italic and underline settings can be + specified by the tags \c {<b>}, \c <i> and \c {<u>}. Note that a + tag does not necessarily have to be closed. A valid example: + \code + This is <font color=red>red</font> while <b>this</b> is <font color=blue>blue</font>. + <font color=green><font color=yellow>Yellow,</font> and <u>green</u>. + \endcode + + Stylesheets can also be used in LogText mode. To create and use a + custom tag, you could do the following: + \code + TQTextEdit * log = new TQTextEdit( this ); + log->setTextFormat( TQt::LogText ); + TQStyleSheetItem * item = new TQStyleSheetItem( log->styleSheet(), "mytag" ); + item->setColor( "red" ); + item->setFontWeight( TQFont::Bold ); + item->setFontUnderline( TRUE ); + log->append( "This is a <mytag>custom tag</mytag>!" ); + \endcode + Note that only the color, bold, underline and italic attributes of + a TQStyleSheetItem is used in LogText mode. + + Note that you can use setMaxLogLines() to limit the number of + lines the widget can hold in LogText mode. + + There are a few things that you need to be aware of when the + widget is in this mode: + \list + \i Functions that deal with rich text formatting and cursor + movement will not work or return anything valid. + \i Lines are equivalent to paragraphs. + \endlist + + \section1 Using TQTextEdit as an Editor + + All the information about using TQTextEdit as a display widget also + applies here. + + The current format's attributes are set with setItalic(), + setBold(), setUnderline(), setFamily() (font family), + setPointSize(), setColor() and setCurrentFont(). The current + paragraph's alignment is set with setAlignment(). + + Use setSelection() to select text. The setSelectionAttributes() + function is used to indicate how selected text should be + displayed. Use hasSelectedText() to find out if any text is + selected. The currently selected text's position is available + using getSelection() and the selected text itself is returned by + selectedText(). The selection can be copied to the clipboard with + copy(), or cut to the clipboard with cut(). It can be deleted with + removeSelectedText(). The entire text can be selected (or + unselected) using selectAll(). TQTextEdit supports multiple + selections. Most of the selection functions operate on the default + selection, selection 0. If the user presses a non-selecting key, + e.g. a cursor key without also holding down Shift, all selections + are cleared. + + Set and get the position of the cursor with setCursorPosition() + and getCursorPosition() respectively. When the cursor is moved, + the signals currentFontChanged(), currentColorChanged() and + currentAlignmentChanged() are emitted to reflect the font, color + and alignment at the new cursor position. + + If the text changes, the textChanged() signal is emitted, and if + the user inserts a new line by pressing Return or Enter, + returnPressed() is emitted. The isModified() function will return + TRUE if the text has been modified. + + TQTextEdit provides command-based undo and redo. To set the depth + of the command history use setUndoDepth() which defaults to 100 + steps. To undo or redo the last operation call undo() or redo(). + The signals undoAvailable() and redoAvailable() indicate whether + the undo and redo operations can be executed. + + The indent() function is used to reindent a paragraph. It is + useful for code editors, for example in \link designer-manual.book + TQt Designer\endlink's code editor \e{Ctrl+I} invokes the indent() + function. + + \section2 Editing key bindings + + The list of key-bindings which are implemented for editing: + \table + \header \i Keypresses \i Action + \row \i Backspace \i Delete the character to the left of the cursor + \row \i Delete \i Delete the character to the right of the cursor + \row \i Ctrl+A \i Move the cursor to the beginning of the line + \row \i Ctrl+B \i Move the cursor one character left + \row \i Ctrl+C \i Copy the marked text to the clipboard (also + Ctrl+Insert under Windows) + \row \i Ctrl+D \i Delete the character to the right of the cursor + \row \i Ctrl+E \i Move the cursor to the end of the line + \row \i Ctrl+F \i Move the cursor one character right + \row \i Ctrl+H \i Delete the character to the left of the cursor + \row \i Ctrl+K \i Delete to end of line + \row \i Ctrl+N \i Move the cursor one line down + \row \i Ctrl+P \i Move the cursor one line up + \row \i Ctrl+V \i Paste the clipboard text into line edit + (also Shift+Insert under Windows) + \row \i Ctrl+X \i Cut the marked text, copy to clipboard + (also Shift+Delete under Windows) + \row \i Ctrl+Z \i Undo the last operation + \row \i Ctrl+Y \i Redo the last operation + \row \i LeftArrow \i Move the cursor one character left + \row \i Ctrl+LeftArrow \i Move the cursor one word left + \row \i RightArrow \i Move the cursor one character right + \row \i Ctrl+RightArrow \i Move the cursor one word right + \row \i UpArrow \i Move the cursor one line up + \row \i Ctrl+UpArrow \i Move the cursor one word up + \row \i DownArrow \i Move the cursor one line down + \row \i Ctrl+Down Arrow \i Move the cursor one word down + \row \i PageUp \i Move the cursor one page up + \row \i PageDown \i Move the cursor one page down + \row \i Home \i Move the cursor to the beginning of the line + \row \i Ctrl+Home \i Move the cursor to the beginning of the text + \row \i End \i Move the cursor to the end of the line + \row \i Ctrl+End \i Move the cursor to the end of the text + \row \i Shift+Wheel \i Scroll the page horizontally + (the Wheel is the mouse wheel) + \row \i Ctrl+Wheel \i Zoom the text + \endtable + + To select (mark) text hold down the Shift key whilst pressing one + of the movement keystrokes, for example, \e{Shift+Right Arrow} + will select the character to the right, and \e{Shift+Ctrl+Right + Arrow} will select the word to the right, etc. + + By default the text edit widget operates in insert mode so all + text that the user enters is inserted into the text edit and any + text to the right of the cursor is moved out of the way. The mode + can be changed to overwrite, where new text overwrites any text to + the right of the cursor, using setOverwriteMode(). +*/ + +/*! + \enum TQTextEdit::AutoFormatting + + \value AutoNone Do not perform any automatic formatting + \value AutoBulletList Only automatically format bulletted lists + \value AutoAll Apply all available autoformatting +*/ + + +/*! + \enum TQTextEdit::KeyboardAction + + This enum is used by doKeyboardAction() to specify which action + should be executed: + + \value ActionBackspace Delete the character to the left of the + cursor. + + \value ActionDelete Delete the character to the right of the + cursor. + + \value ActionReturn Split the paragraph at the cursor position. + + \value ActionKill If the cursor is not at the end of the + paragraph, delete the text from the cursor position until the end + of the paragraph. If the cursor is at the end of the paragraph, + delete the hard line break at the end of the paragraph: this will + cause this paragraph to be joined with the following paragraph. + + \value ActionWordBackspace Delete the word to the left of the + cursor position. + + \value ActionWordDelete Delete the word to the right of the + cursor position + +*/ + +/*! + \enum TQTextEdit::VerticalAlignment + + This enum is used to set the vertical alignment of the text. + + \value AlignNormal Normal alignment + \value AlignSuperScript Superscript + \value AlignSubScript Subscript +*/ + +/*! + \enum TQTextEdit::TextInsertionFlags + + \internal + + \value RedoIndentation + \value CheckNewLines + \value RemoveSelected +*/ + + +/*! + \fn void TQTextEdit::copyAvailable(bool yes) + + This signal is emitted when text is selected or de-selected in the + text edit. + + When text is selected this signal will be emitted with \a yes set + to TRUE. If no text has been selected or if the selected text is + de-selected this signal is emitted with \a yes set to FALSE. + + If \a yes is TRUE then copy() can be used to copy the selection to + the clipboard. If \a yes is FALSE then copy() does nothing. + + \sa selectionChanged() +*/ + + +/*! + \fn void TQTextEdit::textChanged() + + This signal is emitted whenever the text in the text edit changes. + + \sa setText() append() +*/ + +/*! + \fn void TQTextEdit::selectionChanged() + + This signal is emitted whenever the selection changes. + + \sa setSelection() copyAvailable() +*/ + +/*! \fn TQTextDocument *TQTextEdit::document() const + + \internal + + This function returns the TQTextDocument which is used by the text + edit. +*/ + +/*! \fn void TQTextEdit::setDocument( TQTextDocument *doc ) + + \internal + + This function sets the TQTextDocument which should be used by the text + edit to \a doc. This can be used, for example, if you want to + display a document using multiple views. You would create a + TQTextDocument and set it to the text edits which should display it. + You would need to connect to the textChanged() and + selectionChanged() signals of all the text edits and update them all + accordingly (preferably with a slight delay for efficiency reasons). +*/ + +/*! + \enum TQTextEdit::CursorAction + + This enum is used by moveCursor() to specify in which direction + the cursor should be moved: + + \value MoveBackward Moves the cursor one character backward + + \value MoveWordBackward Moves the cursor one word backward + + \value MoveForward Moves the cursor one character forward + + \value MoveWordForward Moves the cursor one word forward + + \value MoveUp Moves the cursor up one line + + \value MoveDown Moves the cursor down one line + + \value MoveLineStart Moves the cursor to the beginning of the line + + \value MoveLineEnd Moves the cursor to the end of the line + + \value MoveHome Moves the cursor to the beginning of the document + + \value MoveEnd Moves the cursor to the end of the document + + \value MovePgUp Moves the cursor one viewport page up + + \value MovePgDown Moves the cursor one viewport page down +*/ + +/*! + \enum TQt::AnchorAttribute + + An anchor has one or more of the following attributes: + + \value AnchorName the name attribute of the anchor. This attribute is + used when scrolling to an anchor in the document. + + \value AnchorHref the href attribute of the anchor. This attribute is + used when a link is clicked to determine what content to load. +*/ + +/*! + \property TQTextEdit::overwriteMode + \brief the text edit's overwrite mode + + If FALSE (the default) characters entered by the user are inserted + with any characters to the right being moved out of the way. If + TRUE, the editor is in overwrite mode, i.e. characters entered by + the user overwrite any characters to the right of the cursor + position. +*/ + +/*! + \fn void TQTextEdit::setCurrentFont( const TQFont &f ) + + Sets the font of the current format to \a f. + + If the widget is in \c LogText mode this function will do + nothing. Use setFont() instead. + + \sa currentFont() setPointSize() setFamily() +*/ + +/*! + \property TQTextEdit::undoDepth + \brief the depth of the undo history + + The maximum number of steps in the undo/redo history. The default + is 100. + + \sa undo() redo() +*/ + +/*! + \fn void TQTextEdit::undoAvailable( bool yes ) + + This signal is emitted when the availability of undo changes. If + \a yes is TRUE, then undo() will work until undoAvailable( FALSE ) + is next emitted. + + \sa undo() undoDepth() +*/ + +/*! + \fn void TQTextEdit::modificationChanged( bool m ) + + This signal is emitted when the modification status of the + document has changed. If \a m is TRUE, the document was modified, + otherwise the modification state has been reset to unmodified. + + \sa modified +*/ + +/*! + \fn void TQTextEdit::redoAvailable( bool yes ) + + This signal is emitted when the availability of redo changes. If + \a yes is TRUE, then redo() will work until redoAvailable( FALSE ) + is next emitted. + + \sa redo() undoDepth() +*/ + +/*! + \fn void TQTextEdit::currentFontChanged( const TQFont &f ) + + This signal is emitted if the font of the current format has + changed. + + The new font is \a f. + + \sa setCurrentFont() +*/ + +/*! + \fn void TQTextEdit::currentColorChanged( const TQColor &c ) + + This signal is emitted if the color of the current format has + changed. + + The new color is \a c. + + \sa setColor() +*/ + +/*! + \fn void TQTextEdit::currentVerticalAlignmentChanged( VerticalAlignment a ) + + This signal is emitted if the vertical alignment of the current + format has changed. + + The new vertical alignment is \a a. + + \sa setVerticalAlignment() +*/ + +/*! + \fn void TQTextEdit::currentAlignmentChanged( int a ) + + This signal is emitted if the alignment of the current paragraph + has changed. + + The new alignment is \a a. + + \sa setAlignment() +*/ + +/*! + \fn void TQTextEdit::cursorPositionChanged( TQTextCursor *c ) + + \internal +*/ + +/*! + \fn void TQTextEdit::cursorPositionChanged( int para, int pos ) + + This signal is emitted if the position of the cursor has changed. + \a para contains the paragraph index and \a pos contains the + character position within the paragraph. + + \sa setCursorPosition() +*/ + +/*! + \fn void TQTextEdit::clicked( int para, int pos ) + + This signal is emitted when the mouse is clicked on the paragraph + \a para at character position \a pos. + + \sa doubleClicked() +*/ + +/*! \fn void TQTextEdit::doubleClicked( int para, int pos ) + + This signal is emitted when the mouse is double-clicked on the + paragraph \a para at character position \a pos. + + \sa clicked() +*/ + + +/*! + \fn void TQTextEdit::returnPressed() + + This signal is emitted if the user pressed the Return or the Enter + key. +*/ + +/*! + \fn TQTextCursor *TQTextEdit::textCursor() const + + Returns the text edit's text cursor. + + \warning TQTextCursor is not in the public API, but in special + circumstances you might wish to use it. +*/ + +/*! + Constructs an empty TQTextEdit called \a name, with parent \a + parent. +*/ + +TQTextEdit::TQTextEdit( TQWidget *parent, const char *name ) + : TQScrollView( parent, name, WStaticContents | WNoAutoErase ), + doc( new TQTextDocument( 0 ) ), undoRedoInfo( doc ) +{ + init(); +} + +/*! + Constructs a TQTextEdit called \a name, with parent \a parent. The + text edit will display the text \a text using context \a context. + + The \a context is a path which the text edit's TQMimeSourceFactory + uses to resolve the locations of files and images. It is passed to + the mimeSourceFactory() when quering data. + + For example if the text contains an image tag, + \c{<img src="image.png">}, and the context is "path/to/look/in", the + TQMimeSourceFactory will try to load the image from + "path/to/look/in/image.png". If the tag was + \c{<img src="/image.png">}, the context will not be used (because + TQMimeSourceFactory recognizes that we have used an absolute path) + and will try to load "/image.png". The context is applied in exactly + the same way to \e hrefs, for example, + \c{<a href="target.html">Target</a>}, would resolve to + "path/to/look/in/target.html". +*/ + +TQTextEdit::TQTextEdit( const TQString& text, const TQString& context, + TQWidget *parent, const char *name) + : TQScrollView( parent, name, WStaticContents | WNoAutoErase ), + doc( new TQTextDocument( 0 ) ), undoRedoInfo( doc ) +{ + init(); + setText( text, context ); +} + +/*! + \reimp +*/ + +TQTextEdit::~TQTextEdit() +{ + delete undoRedoInfo.d; + undoRedoInfo.d = 0; + delete cursor; + delete doc; +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + delete d->od; +#endif + delete d; +} + +void TQTextEdit::init() +{ + d = new TQTextEditPrivate; + doc->formatCollection()->setPaintDevice( this ); + undoEnabled = TRUE; + readOnly = TRUE; + setReadOnly( FALSE ); + setFrameStyle( LineEditPanel | Sunken ); + connect( doc, TQ_SIGNAL( minimumWidthChanged(int) ), + this, TQ_SLOT( documentWidthChanged(int) ) ); + + mousePressed = FALSE; + inDoubleClick = FALSE; + modified = FALSE; + onLink = TQString::null; + d->onName = TQString::null; + overWrite = FALSE; + wrapMode = WidgetWidth; + wrapWidth = -1; + wPolicy = AtWhiteSpace; + mightStartDrag = FALSE; + inDnD = FALSE; + doc->setFormatter( new TQTextFormatterBreakWords ); + doc->formatCollection()->defaultFormat()->setFont( TQScrollView::font() ); + doc->formatCollection()->defaultFormat()->setColor( colorGroup().color( TQColorGroup::Text ) ); + currentFormat = doc->formatCollection()->defaultFormat(); + currentAlignment = TQt::AlignAuto; + + setBackgroundMode( PaletteBase ); + viewport()->setBackgroundMode( PaletteBase ); + viewport()->setAcceptDrops( TRUE ); + resizeContents( 0, doc->lastParagraph() ? + ( doc->lastParagraph()->paragId() + 1 ) * doc->formatCollection()->defaultFormat()->height() : 0 ); + + setKeyCompression( TRUE ); + viewport()->setMouseTracking( TRUE ); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + cursor = new TQTextCursor( doc ); + + formatTimer = new TQTimer( this ); + connect( formatTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( formatMore() ) ); + lastFormatted = doc->firstParagraph(); + + scrollTimer = new TQTimer( this ); + connect( scrollTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( autoScrollTimerDone() ) ); + + interval = 0; + changeIntervalTimer = new TQTimer( this ); + connect( changeIntervalTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( doChangeInterval() ) ); + + cursorVisible = TRUE; + blinkTimer = new TQTimer( this ); + connect( blinkTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( blinkCursor() ) ); + +#ifndef TQT_NO_DRAGANDDROP + dragStartTimer = new TQTimer( this ); + connect( dragStartTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( startDrag() ) ); +#endif + + d->trippleClickTimer = new TQTimer( this ); + + formatMore(); + + blinkCursorVisible = FALSE; + + viewport()->setFocusProxy( this ); + viewport()->setFocusPolicy( WheelFocus ); + setInputMethodEnabled( TRUE ); + viewport()->installEventFilter( this ); + connect( this, TQ_SIGNAL(horizontalSliderReleased()), this, TQ_SLOT(sliderReleased()) ); + connect( this, TQ_SIGNAL(verticalSliderReleased()), this, TQ_SLOT(sliderReleased()) ); + installEventFilter( this ); +} + +void TQTextEdit::paintDocument( bool drawAll, TQPainter *p, int cx, int cy, int cw, int ch ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + Q_ASSERT( !d->optimMode ); + if ( d->optimMode ) + return; +#endif + + bool drawCur = hasFocus() || viewport()->hasFocus(); + if (( hasSelectedText() && !style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) || + isReadOnly() || !cursorVisible || doc->hasSelection( TQTextDocument::IMSelectionText )) + drawCur = FALSE; + TQColorGroup g = colorGroup(); + const TQColorGroup::ColorRole backRole = TQPalette::backgroundRoleFromMode(backgroundMode()); + if ( doc->paper() ) + g.setBrush( backRole, *doc->paper() ); + + if ( contentsY() < doc->y() ) { + p->fillRect( contentsX(), contentsY(), visibleWidth(), doc->y(), + g.brush( backRole ) ); + } + if ( drawAll && doc->width() - contentsX() < cx + cw ) { + p->fillRect( doc->width() - contentsX(), cy, cx + cw - doc->width() + contentsX(), ch, + g.brush( backRole ) ); + } + + p->setBrushOrigin( -contentsX(), -contentsY() ); + + lastFormatted = doc->draw( p, cx, cy, cw, ch, g, !drawAll, drawCur, cursor ); + + if ( lastFormatted == doc->lastParagraph() ) + resizeContents( contentsWidth(), doc->height() ); + + if ( contentsHeight() < visibleHeight() && ( !doc->lastParagraph() || doc->lastParagraph()->isValid() ) && drawAll ) + p->fillRect( 0, contentsHeight(), visibleWidth(), + visibleHeight() - contentsHeight(), g.brush( backRole ) ); +} + +/*! + \reimp +*/ + +void TQTextEdit::drawContents( TQPainter *p, int cx, int cy, int cw, int ch ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimDrawContents( p, cx, cy, cw, ch ); + return; + } +#endif + paintDocument( TRUE, p, cx, cy, cw, ch ); + int v; + p->setPen( foregroundColor() ); + if ( document()->isPageBreakEnabled() && ( v = document()->flow()->pageSize() ) > 0 ) { + int l = int(cy / v) * v; + while ( l < cy + ch ) { + p->drawLine( cx, l, cx + cw - 1, l ); + l += v; + } + } + + // This invocation is required to follow dragging of active window + // by the showed candidate window. + updateMicroFocusHint(); +} + +/*! + \reimp +*/ + +void TQTextEdit::drawContents( TQPainter *p ) +{ + if ( horizontalScrollBar()->isVisible() && + verticalScrollBar()->isVisible() ) { + const TQRect verticalRect = verticalScrollBar()->geometry(); + const TQRect horizontalRect = horizontalScrollBar()->geometry(); + + TQRect cornerRect; + cornerRect.setTop( verticalRect.bottom() ); + cornerRect.setBottom( horizontalRect.bottom() ); + cornerRect.setLeft( verticalRect.left() ); + cornerRect.setRight( verticalRect.right() ); + + p->fillRect( cornerRect, colorGroup().background() ); + } +} + +/*! + \reimp +*/ + +bool TQTextEdit::event( TQEvent *e ) +{ + if ( e->type() == TQEvent::AccelOverride && !isReadOnly() ) { + TQKeyEvent* ke = (TQKeyEvent*) e; + switch((int)(ke->state())) { + case NoButton: + case Keypad: + case ShiftButton: + if ( ke->key() < Key_Escape ) { + ke->accept(); + } else { + switch ( ke->key() ) { + case Key_Return: + case Key_Enter: + case Key_Delete: + case Key_Home: + case Key_End: + case Key_Backspace: + case Key_Left: + case Key_Right: + ke->accept(); + default: + break; + } + } + break; + + case ControlButton: + case ControlButton|ShiftButton: + case ControlButton|Keypad: + case ControlButton|ShiftButton|Keypad: + switch ( ke->key() ) { + case Key_Tab: + case Key_Backtab: + ke->ignore(); + break; +// Those are too frequently used for application functionality +/* case Key_A: + case Key_B: + case Key_D: + case Key_E: + case Key_F: + case Key_H: + case Key_I: + case Key_K: + case Key_N: + case Key_P: + case Key_T: +*/ + case Key_C: + case Key_V: + case Key_X: + case Key_Y: + case Key_Z: + case Key_Left: + case Key_Right: + case Key_Up: + case Key_Down: + case Key_Home: + case Key_End: +#if defined (TQ_WS_WIN) + case Key_Insert: + case Key_Delete: +#endif + ke->accept(); + default: + break; + } + break; + + default: + switch ( ke->key() ) { +#if defined (TQ_WS_WIN) + case Key_Insert: + ke->accept(); +#endif + default: + break; + } + break; + } + } + + if ( e->type() == TQEvent::Show ) { + if ( +#ifdef QT_TEXTEDIT_OPTIMIZATION + !d->optimMode && +#endif + d->ensureCursorVisibleInShowEvent ) { + ensureCursorVisible(); + d->ensureCursorVisibleInShowEvent = FALSE; + } + if ( !d->scrollToAnchor.isEmpty() ) { + scrollToAnchor( d->scrollToAnchor ); + d->scrollToAnchor = TQString::null; + } + } + return TQWidget::event( e ); +} + +/*! + Processes the key event, \a e. By default key events are used to + provide keyboard navigation and text editing. +*/ + +void TQTextEdit::keyPressEvent( TQKeyEvent *e ) +{ + changeIntervalTimer->stop(); + interval = 10; + bool unknownKey = FALSE; + if ( isReadOnly() ) { + if ( !handleReadOnlyKeyEvent( e ) ) + TQScrollView::keyPressEvent( e ); + changeIntervalTimer->start( 100, TRUE ); + return; + } + + + bool selChanged = FALSE; + for ( int i = 1; i < doc->numSelections(); ++i ) // start with 1 as we don't want to remove the Standard-Selection + selChanged = doc->removeSelection( i ) || selChanged; + + if ( selChanged ) { + cursor->paragraph()->document()->nextDoubleBuffered = TRUE; + repaintChanged(); + } + + bool clearUndoRedoInfo = TRUE; + + + switch ( e->key() ) { + case Key_Left: + case Key_Right: { + // a bit hacky, but can't change this without introducing new enum values for move and keeping the + // correct semantics and movement for BiDi and non BiDi text. + CursorAction a; + if ( cursor->paragraph()->string()->isRightToLeft() == (e->key() == Key_Right) ) + a = e->state() & ControlButton ? MoveWordBackward : MoveBackward; + else + a = e->state() & ControlButton ? MoveWordForward : MoveForward; + moveCursor( a, e->state() & ShiftButton ); + break; + } + case Key_Up: + moveCursor( e->state() & ControlButton ? MovePgUp : MoveUp, e->state() & ShiftButton ); + break; + case Key_Down: + moveCursor( e->state() & ControlButton ? MovePgDown : MoveDown, e->state() & ShiftButton ); + break; + case Key_Home: + moveCursor( e->state() & ControlButton ? MoveHome : MoveLineStart, e->state() & ShiftButton ); + break; + case Key_End: + moveCursor( e->state() & ControlButton ? MoveEnd : MoveLineEnd, e->state() & ShiftButton ); + break; + case Key_Prior: + moveCursor( MovePgUp, e->state() & ShiftButton ); + break; + case Key_Next: + moveCursor( MovePgDown, e->state() & ShiftButton ); + break; + case Key_Return: case Key_Enter: + if ( doc->hasSelection( TQTextDocument::Standard, FALSE ) ) + removeSelectedText(); + if ( textFormat() == TQt::RichText && ( e->state() & ControlButton ) ) { + // Ctrl-Enter inserts a line break in rich text mode + insert( TQString( TQChar( 0x2028) ), TRUE, FALSE ); + } else { +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + clearUndoRedoInfo = FALSE; + doKeyboardAction( ActionReturn ); + emit returnPressed(); + } + break; + case Key_Delete: +#if defined (TQ_WS_WIN) + if ( e->state() & ShiftButton ) { + cut(); + break; + } else +#endif + if ( doc->hasSelection( TQTextDocument::Standard, TRUE ) ) { + removeSelectedText(); + break; + } + doKeyboardAction( e->state() & ControlButton ? ActionWordDelete + : ActionDelete ); + clearUndoRedoInfo = FALSE; + + break; + case Key_Insert: + if ( e->state() & ShiftButton ) + paste(); +#if defined (TQ_WS_WIN) + else if ( e->state() & ControlButton ) + copy(); +#endif + else + setOverwriteMode( !isOverwriteMode() ); + break; + case Key_Backspace: +#if defined (TQ_WS_WIN) + if ( e->state() & AltButton ) { + if (e->state() & ControlButton ) { + break; + } else if ( e->state() & ShiftButton ) { + redo(); + break; + } else { + undo(); + break; + } + } else +#endif + if ( doc->hasSelection( TQTextDocument::Standard, TRUE ) ) { + removeSelectedText(); + break; + } + + doKeyboardAction( e->state() & ControlButton ? ActionWordBackspace + : ActionBackspace ); + clearUndoRedoInfo = FALSE; + break; + case Key_F16: // Copy key on Sun keyboards + copy(); + break; + case Key_F18: // Paste key on Sun keyboards + paste(); + break; + case Key_F20: // Cut key on Sun keyboards + cut(); + break; + case Key_Direction_L: + if ( doc->textFormat() == TQt::PlainText ) { + // change the whole doc + TQTextParagraph *p = doc->firstParagraph(); + while ( p ) { + p->setDirection( TQChar::DirL ); + p->setAlignment( TQt::AlignLeft ); + p->invalidate( 0 ); + p = p->next(); + } + } else { + if ( !cursor->paragraph() || cursor->paragraph()->direction() == TQChar::DirL ) + return; + cursor->paragraph()->setDirection( TQChar::DirL ); + if ( cursor->paragraph()->length() <= 1&& + ( (cursor->paragraph()->alignment() & (TQt::AlignLeft | TQt::AlignRight) ) != 0 ) ) + setAlignment( TQt::AlignLeft ); + } + repaintChanged(); + break; + case Key_Direction_R: + if ( doc->textFormat() == TQt::PlainText ) { + // change the whole doc + TQTextParagraph *p = doc->firstParagraph(); + while ( p ) { + p->setDirection( TQChar::DirR ); + p->setAlignment( TQt::AlignRight ); + p->invalidate( 0 ); + p = p->next(); + } + } else { + if ( !cursor->paragraph() || cursor->paragraph()->direction() == TQChar::DirR ) + return; + cursor->paragraph()->setDirection( TQChar::DirR ); + if ( cursor->paragraph()->length() <= 1&& + ( (cursor->paragraph()->alignment() & (TQt::AlignLeft | TQt::AlignRight) ) != 0 ) ) + setAlignment( TQt::AlignRight ); + } + repaintChanged(); + break; + default: { + if ( e->text().length() && + ( ( !( e->state() & ControlButton ) && +#ifndef Q_OS_MACX + !( e->state() & AltButton ) && +#endif + !( e->state() & MetaButton ) ) || + ( ( (e->state()&ControlButton) | AltButton ) == (ControlButton|AltButton) ) ) && + ( !e->ascii() || e->ascii() >= 32 || e->text() == "\t" ) ) { + clearUndoRedoInfo = FALSE; + if ( e->key() == Key_Tab ) { + if ( d->tabChangesFocus ) { + e->ignore(); + break; + } + if ( textFormat() == TQt::RichText && cursor->index() == 0 + && ( cursor->paragraph()->isListItem() || cursor->paragraph()->listDepth() ) ) { + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Style; + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.eid = undoRedoInfo.id; + undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); + cursor->paragraph()->setListDepth( cursor->paragraph()->listDepth() +1 ); + clearUndoRedo(); + drawCursor( FALSE ); + repaintChanged(); + drawCursor( TRUE ); + break; + } + } else if ( e->key() == Key_BackTab ) { + if ( d->tabChangesFocus ) { + e->ignore(); + break; + } + } + + if ( ( autoFormatting() & AutoBulletList ) && + textFormat() == TQt::RichText && cursor->index() == 0 + && !cursor->paragraph()->isListItem() + && ( e->text()[0] == '-' || e->text()[0] == '*' ) ) { + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Style; + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.eid = undoRedoInfo.id; + undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); + setParagType( TQStyleSheetItem::DisplayListItem, TQStyleSheetItem::ListDisc ); + clearUndoRedo(); + drawCursor( FALSE ); + repaintChanged(); + drawCursor( TRUE ); + break; + } + if (overWrite && !cursor->atParagEnd() && !doc->hasSelection(TQTextDocument::Standard)) { + doKeyboardAction(ActionDelete); + clearUndoRedoInfo = FALSE; + } + TQString t = e->text(); +#ifdef TQ_WS_X11 + extern bool tqt_hebrew_keyboard_hack; + if ( tqt_hebrew_keyboard_hack ) { + // the X11 keyboard layout is broken and does not reverse + // braces correctly. This is a hack to get halfway correct + // behaviour + TQTextParagraph *p = cursor->paragraph(); + if ( p && p->string() && p->string()->isRightToLeft() ) { + TQChar *c = (TQChar *)t.unicode(); + int l = t.length(); + while( l-- ) { + if ( c->mirrored() ) + *c = c->mirroredChar(); + c++; + } + } + } +#endif + insert( t, TRUE, FALSE ); + break; + } else if ( e->state() & ControlButton ) { + switch ( e->key() ) { + case Key_C: case Key_F16: // Copy key on Sun keyboards + copy(); + break; + case Key_V: + paste(); + break; + case Key_X: + cut(); + break; + case Key_I: case Key_T: case Key_Tab: + if ( !d->tabChangesFocus ) + indent(); + break; + case Key_A: +#if defined(TQ_WS_X11) + moveCursor( MoveLineStart, e->state() & ShiftButton ); +#else + selectAll( TRUE ); +#endif + break; + case Key_B: + moveCursor( MoveBackward, e->state() & ShiftButton ); + break; + case Key_F: + moveCursor( MoveForward, e->state() & ShiftButton ); + break; + case Key_D: + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + removeSelectedText(); + break; + } + doKeyboardAction( ActionDelete ); + clearUndoRedoInfo = FALSE; + break; + case Key_H: + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + removeSelectedText(); + break; + } + if ( !cursor->paragraph()->prev() && + cursor->atParagStart() ) + break; + + doKeyboardAction( ActionBackspace ); + clearUndoRedoInfo = FALSE; + break; + case Key_E: + moveCursor( MoveLineEnd, e->state() & ShiftButton ); + break; + case Key_N: + moveCursor( MoveDown, e->state() & ShiftButton ); + break; + case Key_P: + moveCursor( MoveUp, e->state() & ShiftButton ); + break; + case Key_Z: + if(e->state() & ShiftButton) + redo(); + else + undo(); + break; + case Key_Y: + redo(); + break; + case Key_K: + doKeyboardAction( ActionKill ); + break; +#if defined(TQ_WS_WIN) + case Key_Insert: + copy(); + break; + case Key_Delete: + del(); + break; +#endif + default: + unknownKey = FALSE; + break; + } + } else { + unknownKey = TRUE; + } + } + } + + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); + if ( clearUndoRedoInfo ) + clearUndoRedo(); + changeIntervalTimer->start( 100, TRUE ); + if ( unknownKey ) + e->ignore(); +} + +/*! + This function is not intended as polymorphic usage. Just a shared code + fragment that calls TQWidget::sendMouseEventToInputContext() easily for this + class. + */ +bool TQTextEdit::sendMouseEventToInputContext( TQMouseEvent *e ) +{ +#ifndef TQT_NO_IM + if ( d->composeMode() ) { + TQTextCursor c( doc ); + if ( c.place( e->pos(), doc->firstParagraph(), FALSE, FALSE, FALSE ) ) { + int mousePos = c.index() - d->preeditStart; + if ( cursor->globalY() == c.globalY() && + mousePos >= 0 && mousePos < d->preeditLength ) { + TQWidget::sendMouseEventToInputContext( mousePos, e->type(), + e->button(), e->state() ); + } + } else if ( e->type() != TQEvent::MouseMove ) { + // send button events on out of preedit + TQWidget::sendMouseEventToInputContext( -1, e->type(), + e->button(), e->state() ); + } + return TRUE; + } +#endif + return FALSE; +} + + +/*! + \reimp +*/ +void TQTextEdit::imStartEvent( TQIMEvent *e ) +{ + if ( isReadOnly() ) { + e->ignore(); + return; + } + + if ( hasSelectedText() ) + removeSelectedText(); + d->preeditStart = cursor->index(); + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::IME; +} + +/*! + \reimp +*/ +void TQTextEdit::imComposeEvent( TQIMEvent *e ) +{ + if ( isReadOnly() ) { + e->ignore(); + return; + } + + doc->removeSelection( TQTextDocument::IMCompositionText ); + doc->removeSelection( TQTextDocument::IMSelectionText ); + + if ( d->composeMode() && cursor->paragraph() ) + cursor->paragraph()->remove( d->preeditStart, d->preeditLength ); + cursor->setIndex( d->preeditStart ); + d->preeditLength = e->text().length(); + + int sellen = e->selectionLength(); + uint insertionFlags = CheckNewLines | RemoveSelected | AsIMCompositionText; + if ( sellen > 0 ) { + insertionFlags |= WithIMSelection; + } + insert( e->text(), insertionFlags ); + // insert can trigger an imEnd event as it emits a textChanged signal, so better + // be careful + if(d->preeditStart != -1) { + cursor->setIndex( d->preeditStart + d->preeditLength ); + TQTextCursor c = *cursor; + cursor->setIndex( d->preeditStart ); + doc->setSelectionStart( TQTextDocument::IMCompositionText, *cursor ); + doc->setSelectionEnd( TQTextDocument::IMCompositionText, c ); + + cursor->setIndex( d->preeditStart + e->cursorPos() ); + + if ( sellen > 0 ) { + cursor->setIndex( d->preeditStart + e->cursorPos() + sellen ); + c = *cursor; + cursor->setIndex( d->preeditStart + e->cursorPos() ); + doc->setSelectionStart( TQTextDocument::IMSelectionText, *cursor ); + doc->setSelectionEnd( TQTextDocument::IMSelectionText, c ); +#if 0 + // Disabled for Asian input method that shows candidate + // window. This behavior is same as TQt/E 2.3.7 which supports + // Asian input methods. Asian input methods need start point + // of IM selection text to place candidate window as adjacent + // to the selection text. + cursor->setIndex( d->preeditStart + d->preeditLength ); +#endif + } + } + + updateMicroFocusHint(); + repaintChanged(); +} + +/*! + \reimp +*/ +void TQTextEdit::imEndEvent( TQIMEvent *e ) +{ + if ( isReadOnly() ) { + e->ignore(); + return; + } + + doc->removeSelection( TQTextDocument::IMCompositionText ); + doc->removeSelection( TQTextDocument::IMSelectionText ); + + if (undoRedoInfo.type == UndoRedoInfo::IME) + undoRedoInfo.type = UndoRedoInfo::Invalid; + + if ( d->composeMode() && cursor->paragraph() ) + cursor->paragraph()->remove( d->preeditStart, d->preeditLength ); + if ( d->preeditStart >= 0 ) { + cursor->setIndex( d->preeditStart ); + //TODO: TQt 4 we should use the new virtual insert function + insert( e->text(), FALSE ); + } + d->preeditStart = d->preeditLength = -1; + + repaintChanged(); +} + + +static bool tqtextedit_ignore_readonly = FALSE; + +/*! + Executes keyboard action \a action. This is normally called by a + key event handler. +*/ + +void TQTextEdit::doKeyboardAction( KeyboardAction action ) +{ + if ( isReadOnly() && !tqtextedit_ignore_readonly ) + return; + + if ( cursor->nestedDepth() != 0 ) // #### for 3.0, disable editing of tables as this is not advanced enough + return; + + lastFormatted = cursor->paragraph(); + drawCursor( FALSE ); + bool doUpdateCurrentFormat = TRUE; + + switch ( action ) { + case ActionWordDelete: + case ActionDelete: + if ( action == ActionDelete && !cursor->atParagEnd() ) { + if ( undoEnabled ) { + checkUndoRedoInfo( UndoRedoInfo::Delete ); + if ( !undoRedoInfo.valid() ) { + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.index = cursor->index(); + undoRedoInfo.d->text = TQString::null; + } + int idx = cursor->index(); + do { + undoRedoInfo.d->text.insert( undoRedoInfo.d->text.length(), cursor->paragraph()->at( idx++ ), TRUE ); + } while ( !cursor->paragraph()->string()->validCursorPosition( idx ) ); + } + cursor->remove(); + } else { + clearUndoRedo(); + doc->setSelectionStart( TQTextDocument::Temp, *cursor ); + if ( action == ActionWordDelete && !cursor->atParagEnd() ) { + cursor->gotoNextWord(); + } else { + cursor->gotoNextLetter(); + } + doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); + removeSelectedText( TQTextDocument::Temp ); + } + break; + case ActionWordBackspace: + case ActionBackspace: + if ( textFormat() == TQt::RichText + && (cursor->paragraph()->isListItem() + || cursor->paragraph()->listDepth() ) + && cursor->index() == 0 ) { + if ( undoEnabled ) { + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Style; + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.eid = undoRedoInfo.id; + undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); + } + int ldepth = cursor->paragraph()->listDepth(); + if ( cursor->paragraph()->isListItem() && ldepth == 1 ) { + cursor->paragraph()->setListItem( FALSE ); + } else if ( TQMAX( ldepth, 1 ) == 1 ) { + cursor->paragraph()->setListItem( FALSE ); + cursor->paragraph()->setListDepth( 0 ); + } else { + cursor->paragraph()->setListDepth( ldepth - 1 ); + } + clearUndoRedo(); + lastFormatted = cursor->paragraph(); + repaintChanged(); + drawCursor( TRUE ); + return; + } + + if ( action == ActionBackspace && !cursor->atParagStart() ) { + if ( undoEnabled ) { + checkUndoRedoInfo( UndoRedoInfo::Delete ); + if ( !undoRedoInfo.valid() ) { + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.index = cursor->index(); + undoRedoInfo.d->text = TQString::null; + } + undoRedoInfo.d->text.insert( 0, cursor->paragraph()->at( cursor->index()-1 ), TRUE ); + undoRedoInfo.index = cursor->index()-1; + } + cursor->removePreviousChar(); + lastFormatted = cursor->paragraph(); + } else if ( cursor->paragraph()->prev() + || (action == ActionWordBackspace + && !cursor->atParagStart()) ) { + clearUndoRedo(); + doc->setSelectionStart( TQTextDocument::Temp, *cursor ); + if ( action == ActionWordBackspace && !cursor->atParagStart() ) { + cursor->gotoPreviousWord(); + } else { + cursor->gotoPreviousLetter(); + } + doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); + removeSelectedText( TQTextDocument::Temp ); + } + break; + case ActionReturn: + if ( undoEnabled ) { + checkUndoRedoInfo( UndoRedoInfo::Return ); + if ( !undoRedoInfo.valid() ) { + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.index = cursor->index(); + undoRedoInfo.d->text = TQString::null; + } + undoRedoInfo.d->text += "\n"; + } + cursor->splitAndInsertEmptyParagraph(); + if ( cursor->paragraph()->prev() ) { + lastFormatted = cursor->paragraph()->prev(); + lastFormatted->invalidate( 0 ); + } + doUpdateCurrentFormat = FALSE; + break; + case ActionKill: + clearUndoRedo(); + doc->setSelectionStart( TQTextDocument::Temp, *cursor ); + if ( cursor->atParagEnd() ) + cursor->gotoNextLetter(); + else + cursor->setIndex( cursor->paragraph()->length() - 1 ); + doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); + removeSelectedText( TQTextDocument::Temp ); + break; + } + + formatMore(); + repaintChanged(); + ensureCursorVisible(); + drawCursor( TRUE ); + updateMicroFocusHint(); + if ( doUpdateCurrentFormat ) + updateCurrentFormat(); + setModified(); + emit textChanged(); +} + +void TQTextEdit::readFormats( TQTextCursor &c1, TQTextCursor &c2, TQTextString &text, bool fillStyles ) +{ +#ifndef TQT_NO_DATASTREAM + TQDataStream styleStream( undoRedoInfo.styleInformation, IO_WriteOnly ); +#endif + c2.restoreState(); + c1.restoreState(); + int lastIndex = text.length(); + if ( c1.paragraph() == c2.paragraph() ) { + for ( int i = c1.index(); i < c2.index(); ++i ) + text.insert( lastIndex + i - c1.index(), c1.paragraph()->at( i ), TRUE ); +#ifndef TQT_NO_DATASTREAM + if ( fillStyles ) { + styleStream << (int) 1; + c1.paragraph()->writeStyleInformation( styleStream ); + } +#endif + } else { + int i; + for ( i = c1.index(); i < c1.paragraph()->length()-1; ++i ) + text.insert( lastIndex++, c1.paragraph()->at( i ), TRUE ); + int num = 2; // start and end, being different + text += "\n"; lastIndex++; + + if (c1.paragraph()->next() != c2.paragraph()) { + num += text.appendParagraphs(c1.paragraph()->next(), c2.paragraph()); + lastIndex = text.length(); + } + + for ( i = 0; i < c2.index(); ++i ) + text.insert( i + lastIndex, c2.paragraph()->at( i ), TRUE ); +#ifndef TQT_NO_DATASTREAM + if ( fillStyles ) { + styleStream << num; + for ( TQTextParagraph *p = c1.paragraph(); --num >= 0; p = p->next() ) + p->writeStyleInformation( styleStream ); + } +#endif + } +} + +/*! + Removes the selection \a selNum (by default 0). This does not + remove the selected text. + + \sa removeSelectedText() +*/ + +void TQTextEdit::removeSelection( int selNum ) +{ + doc->removeSelection( selNum ); + repaintChanged(); +} + +/*! + Deletes the text of selection \a selNum (by default, the default + selection, 0). If there is no selected text nothing happens. + + \sa selectedText removeSelection() +*/ + +void TQTextEdit::removeSelectedText( int selNum ) +{ + if(selNum != 0) + resetInputContext(); + + TQTextCursor c1 = doc->selectionStartCursor( selNum ); + c1.restoreState(); + TQTextCursor c2 = doc->selectionEndCursor( selNum ); + c2.restoreState(); + + // ### no support for editing tables yet, plus security for broken selections + if ( c1.nestedDepth() || c2.nestedDepth() ) + return; + + for ( int i = 0; i < (int)doc->numSelections(); ++i ) { + if ( i == selNum ) + continue; + doc->removeSelection( i ); + } + + drawCursor( FALSE ); + if ( undoEnabled ) { + checkUndoRedoInfo( UndoRedoInfo::RemoveSelected ); + if ( !undoRedoInfo.valid() ) { + doc->selectionStart( selNum, undoRedoInfo.id, undoRedoInfo.index ); + undoRedoInfo.d->text = TQString::null; + } + readFormats( c1, c2, undoRedoInfo.d->text, TRUE ); + } + + doc->removeSelectedText( selNum, cursor ); + if ( cursor->isValid() ) { + lastFormatted = 0; // make sync a noop + ensureCursorVisible(); + lastFormatted = cursor->paragraph(); + formatMore(); + repaintContents( FALSE ); + ensureCursorVisible(); + drawCursor( TRUE ); + clearUndoRedo(); +#if defined(TQ_WS_WIN) + // there seems to be a problem with repainting or erasing the area + // of the scrollview which is not the contents on windows + if ( contentsHeight() < visibleHeight() ) + viewport()->repaint( 0, contentsHeight(), visibleWidth(), visibleHeight() - contentsHeight(), TRUE ); +#endif +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + updateMicroFocusHint(); + } else { + delete cursor; + cursor = new TQTextCursor( doc ); + drawCursor( TRUE ); + repaintContents( TRUE ); + } + setModified(); + emit textChanged(); + emit selectionChanged(); + emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); +} + +/*! + Moves the text cursor according to \a action. This is normally + used by some key event handler. \a select specifies whether the + text between the current cursor position and the new position + should be selected. +*/ + +void TQTextEdit::moveCursor( CursorAction action, bool select ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return; +#endif +#ifdef TQ_WS_MACX + TQTextCursor c1 = *cursor; + TQTextCursor c2; +#endif + drawCursor( FALSE ); + if ( select ) { + if ( !doc->hasSelection( TQTextDocument::Standard ) ) + doc->setSelectionStart( TQTextDocument::Standard, *cursor ); + moveCursor( action ); +#ifdef TQ_WS_MACX + c2 = *cursor; + if (c1 == c2) + if (action == MoveDown || action == MovePgDown) + moveCursor( MoveEnd ); + else if (action == MoveUp || action == MovePgUp) + moveCursor( MoveHome ); +#endif + if ( doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) ) { + cursor->paragraph()->document()->nextDoubleBuffered = TRUE; + repaintChanged(); + } else { + drawCursor( TRUE ); + } + ensureCursorVisible(); + emit selectionChanged(); + emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); + } else { +#ifdef TQ_WS_MACX + TQTextCursor cStart = doc->selectionStartCursor( TQTextDocument::Standard ); + TQTextCursor cEnd = doc->selectionEndCursor( TQTextDocument::Standard ); + bool redraw = doc->removeSelection( TQTextDocument::Standard ); + if (redraw && action == MoveDown) + *cursor = cEnd; + else if (redraw && action == MoveUp) + *cursor = cStart; + if (redraw && action == MoveForward) + *cursor = cEnd; + else if (redraw && action == MoveBackward) + *cursor = cStart; + else + moveCursor( action ); + c2 = *cursor; + if (c1 == c2) + if (action == MoveDown) + moveCursor( MoveEnd ); + else if (action == MoveUp) + moveCursor( MoveHome ); +#else + bool redraw = doc->removeSelection( TQTextDocument::Standard ); + moveCursor( action ); +#endif + if ( !redraw ) { + ensureCursorVisible(); + drawCursor( TRUE ); + } else { + cursor->paragraph()->document()->nextDoubleBuffered = TRUE; + repaintChanged(); + ensureCursorVisible(); + drawCursor( TRUE ); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + } + if ( redraw ) { + emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); + emit selectionChanged(); + } + } + + drawCursor( TRUE ); + updateCurrentFormat(); + updateMicroFocusHint(); +} + +/*! + \overload +*/ + +void TQTextEdit::moveCursor( CursorAction action ) +{ + resetInputContext(); + switch ( action ) { + case MoveBackward: + cursor->gotoPreviousLetter(); + break; + case MoveWordBackward: + cursor->gotoPreviousWord(); + break; + case MoveForward: + cursor->gotoNextLetter(); + break; + case MoveWordForward: + cursor->gotoNextWord(); + break; + case MoveUp: + cursor->gotoUp(); + break; + case MovePgUp: + cursor->gotoPageUp( visibleHeight() ); + break; + case MoveDown: + cursor->gotoDown(); + break; + case MovePgDown: + cursor->gotoPageDown( visibleHeight() ); + break; + case MoveLineStart: + cursor->gotoLineStart(); + break; + case MoveHome: + cursor->gotoHome(); + break; + case MoveLineEnd: + cursor->gotoLineEnd(); + break; + case MoveEnd: + ensureFormatted( doc->lastParagraph() ); + cursor->gotoEnd(); + break; + } + updateMicroFocusHint(); + updateCurrentFormat(); +} + +/*! + \reimp +*/ + +void TQTextEdit::resizeEvent( TQResizeEvent *e ) +{ + TQScrollView::resizeEvent( e ); + if ( doc->visibleWidth() == 0 ) + doResize(); +} + +/*! + \reimp +*/ + +void TQTextEdit::viewportResizeEvent( TQResizeEvent *e ) +{ + TQScrollView::viewportResizeEvent( e ); + if ( e->oldSize().width() != e->size().width() ) { + bool stayAtBottom = e->oldSize().height() != e->size().height() && + contentsY() > 0 && contentsY() >= doc->height() - e->oldSize().height(); + doResize(); + if ( stayAtBottom ) + scrollToBottom(); + } +} + +/*! + Ensures that the cursor is visible by scrolling the text edit if + necessary. + + \sa setCursorPosition() +*/ + +void TQTextEdit::ensureCursorVisible() +{ + // Not visible or the user is draging the window, so don't position to caret yet + if ( !isUpdatesEnabled() || !isVisible() || isHorizontalSliderPressed() || isVerticalSliderPressed() ) { + d->ensureCursorVisibleInShowEvent = TRUE; + return; + } + sync(); + TQTextStringChar *chr = cursor->paragraph()->at( cursor->index() ); + int h = cursor->paragraph()->lineHeightOfChar( cursor->index() ); + int x = cursor->paragraph()->rect().x() + chr->x + cursor->offsetX(); + int y = 0; int dummy; + cursor->paragraph()->lineHeightOfChar( cursor->index(), &dummy, &y ); + y += cursor->paragraph()->rect().y() + cursor->offsetY(); + int w = 1; + ensureVisible( x, y + h / 2, w, h / 2 + 2 ); +} + +/*! + \internal +*/ +void TQTextEdit::sliderReleased() +{ + if ( d->ensureCursorVisibleInShowEvent && isVisible() ) { + d->ensureCursorVisibleInShowEvent = FALSE; + ensureCursorVisible(); + } +} + +/*! + \internal +*/ +void TQTextEdit::drawCursor( bool visible ) +{ + if ( !isUpdatesEnabled() || + !viewport()->isUpdatesEnabled() || + !cursor->paragraph() || + !cursor->paragraph()->isValid() || + ( !style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) && + ( d->optimMode ? optimHasSelection() : doc->hasSelection( TQTextDocument::Standard, TRUE ))) || + ( visible && !hasFocus() && !viewport()->hasFocus() && !inDnD ) || + doc->hasSelection( TQTextDocument::IMSelectionText ) || + isReadOnly() ) + return; + + // Asian users regard selection text as cursor on candidate + // selection phase of input method, so ordinary cursor should be + // invisible if IM selection text exists. + if ( doc->hasSelection( TQTextDocument::IMSelectionText ) ) { + visible = FALSE; + } + + TQPainter p( viewport() ); + TQRect r( cursor->topParagraph()->rect() ); + cursor->paragraph()->setChanged( TRUE ); + p.translate( -contentsX() + cursor->totalOffsetX(), -contentsY() + cursor->totalOffsetY() ); + TQPixmap *pix = 0; + TQColorGroup cg( colorGroup() ); + const TQColorGroup::ColorRole backRole = TQPalette::backgroundRoleFromMode(backgroundMode()); + if ( cursor->paragraph()->background() ) + cg.setBrush( backRole, *cursor->paragraph()->background() ); + else if ( doc->paper() ) + cg.setBrush( backRole, *doc->paper() ); + p.setBrushOrigin( -contentsX(), -contentsY() ); + cursor->paragraph()->document()->nextDoubleBuffered = TRUE; + if ( !cursor->nestedDepth() ) { + int h = cursor->paragraph()->lineHeightOfChar( cursor->index() ); + int dist = 5; + if ( ( cursor->paragraph()->alignment() & TQt::AlignJustify ) == TQt::AlignJustify ) + dist = 50; + int x = r.x() - cursor->totalOffsetX() + cursor->x() - dist; + x = TQMAX( x, 0 ); + p.setClipRect( TQRect( x - contentsX(), + r.y() - cursor->totalOffsetY() + cursor->y() - contentsY(), 2 * dist, h ) ); + doc->drawParagraph( &p, cursor->paragraph(), x, + r.y() - cursor->totalOffsetY() + cursor->y(), 2 * dist, h, pix, cg, visible, cursor ); + } else { + doc->drawParagraph( &p, cursor->paragraph(), r.x() - cursor->totalOffsetX(), + r.y() - cursor->totalOffsetY(), r.width(), r.height(), + pix, cg, visible, cursor ); + } + cursorVisible = visible; +} + +enum { + IdUndo = 0, + IdRedo = 1, + IdCut = 2, + IdCopy = 3, + IdPaste = 4, + IdClear = 5, + IdSelectAll = 6 +}; + +/*! + \reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQTextEdit::contentsWheelEvent( TQWheelEvent *e ) +{ + if ( isReadOnly() ) { + if ( e->state() & ControlButton ) { + if ( e->delta() > 0 ) + zoomOut(); + else if ( e->delta() < 0 ) + zoomIn(); + return; + } + } + TQScrollView::contentsWheelEvent( e ); +} +#endif + +/*! + \reimp +*/ + +void TQTextEdit::contentsMousePressEvent( TQMouseEvent *e ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimMousePressEvent( e ); + return; + } +#endif + + if ( sendMouseEventToInputContext( e ) ) + return; + + if ( d->trippleClickTimer->isActive() && + ( e->globalPos() - d->trippleClickPoint ).manhattanLength() < + TQApplication::startDragDistance() ) { + TQTextCursor c1 = *cursor; + TQTextCursor c2 = *cursor; + c1.gotoLineStart(); + c2.gotoLineEnd(); + doc->setSelectionStart( TQTextDocument::Standard, c1 ); + doc->setSelectionEnd( TQTextDocument::Standard, c2 ); + *cursor = c2; + repaintChanged(); + mousePressed = TRUE; + return; + } + + clearUndoRedo(); + TQTextCursor oldCursor = *cursor; + TQTextCursor c = *cursor; + mousePos = e->pos(); + mightStartDrag = FALSE; + pressedLink = TQString::null; + d->pressedName = TQString::null; + + if ( e->button() == LeftButton ) { + mousePressed = TRUE; + drawCursor( FALSE ); + placeCursor( e->pos() ); + ensureCursorVisible(); + + if ( isReadOnly() && linksEnabled() ) { + TQTextCursor c = *cursor; + placeCursor( e->pos(), &c, TRUE ); + if ( c.paragraph() && c.paragraph()->at( c.index() ) && + c.paragraph()->at( c.index() )->isAnchor() ) { + pressedLink = c.paragraph()->at( c.index() )->anchorHref(); + d->pressedName = c.paragraph()->at( c.index() )->anchorName(); + } + } + +#ifndef TQT_NO_DRAGANDDROP + if ( doc->inSelection( TQTextDocument::Standard, e->pos() ) ) { + mightStartDrag = TRUE; + drawCursor( TRUE ); + dragStartTimer->start( TQApplication::startDragTime(), TRUE ); + dragStartPos = e->pos(); + return; + } +#endif + + bool redraw = FALSE; + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + if ( !( e->state() & ShiftButton ) ) { + redraw = doc->removeSelection( TQTextDocument::Standard ); + doc->setSelectionStart( TQTextDocument::Standard, *cursor ); + } else { + redraw = doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) || redraw; + } + } else { + if ( isReadOnly() || !( e->state() & ShiftButton ) ) { + doc->setSelectionStart( TQTextDocument::Standard, *cursor ); + } else { + doc->setSelectionStart( TQTextDocument::Standard, c ); + redraw = doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) || redraw; + } + } + + for ( int i = 1; i < doc->numSelections(); ++i ) // start with 1 as we don't want to remove the Standard-Selection + redraw = doc->removeSelection( i ) || redraw; + + if ( !redraw ) { + drawCursor( TRUE ); + } else { + repaintChanged(); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + } + } else if ( e->button() == MidButton ) { + bool redraw = doc->removeSelection( TQTextDocument::Standard ); + if ( !redraw ) { + drawCursor( TRUE ); + } else { + repaintChanged(); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + } + } + + if ( *cursor != oldCursor ) + updateCurrentFormat(); +} + +/*! + \reimp +*/ + +void TQTextEdit::contentsMouseMoveEvent( TQMouseEvent *e ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimMouseMoveEvent( e ); + return; + } +#endif + if ( sendMouseEventToInputContext( e ) ) { + // don't return from here to avoid cursor vanishing + } else if ( mousePressed ) { +#ifndef TQT_NO_DRAGANDDROP + if ( mightStartDrag ) { + dragStartTimer->stop(); + if ( ( e->pos() - dragStartPos ).manhattanLength() > TQApplication::startDragDistance() ) { + TQGuardedPtr<TQTextEdit> guard( this ); + startDrag(); + if (guard.isNull()) // we got deleted during the dnd + return; + } +#ifndef TQT_NO_CURSOR + if ( !isReadOnly() ) + viewport()->setCursor( ibeamCursor ); +#endif + return; + } +#endif + mousePos = e->pos(); + handleMouseMove( mousePos ); + oldMousePos = mousePos; + } + +#ifndef TQT_NO_CURSOR + if ( !isReadOnly() && !mousePressed ) { + if ( doc->hasSelection( TQTextDocument::Standard ) && doc->inSelection( TQTextDocument::Standard, e->pos() ) ) + viewport()->setCursor( arrowCursor ); + else + viewport()->setCursor( ibeamCursor ); + } +#endif + updateCursor( e->pos() ); +} + +void TQTextEdit::copyToClipboard() +{ +#ifndef TQT_NO_CLIPBOARD + if (TQApplication::clipboard()->supportsSelection()) { + d->clipboard_mode = TQClipboard::Selection; + + // don't listen to selection changes + disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), this, 0); + copy(); + // listen to selection changes + connect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), + this, TQ_SLOT(clipboardChanged()) ); + + d->clipboard_mode = TQClipboard::Clipboard; + } +#endif +} + +/*! + \reimp +*/ + +void TQTextEdit::contentsMouseReleaseEvent( TQMouseEvent * e ) +{ + if ( !inDoubleClick && !d->composeMode() ) { // could be the release of a dblclick + int para = 0; + int index = charAt( e->pos(), ¶ ); + emit clicked( para, index ); + } +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimMouseReleaseEvent( e ); + return; + } +#endif + if ( sendMouseEventToInputContext( e ) ) + return; + TQTextCursor oldCursor = *cursor; + if ( scrollTimer->isActive() ) + scrollTimer->stop(); +#ifndef TQT_NO_DRAGANDDROP + if ( dragStartTimer->isActive() ) + dragStartTimer->stop(); + if ( mightStartDrag ) { + selectAll( FALSE ); + mousePressed = FALSE; + } +#endif + bool mouseWasPressed = mousePressed; + if ( mousePressed ) { + mousePressed = FALSE; + copyToClipboard(); + } +#ifndef TQT_NO_CLIPBOARD + else if ( e->button() == MidButton && !isReadOnly() ) { + // only do middle-click pasting on systems that have selections (ie. X11) + if (TQApplication::clipboard()->supportsSelection()) { + drawCursor( FALSE ); + placeCursor( e->pos() ); + ensureCursorVisible(); + doc->setSelectionStart( TQTextDocument::Standard, oldCursor ); + bool redraw = FALSE; + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + redraw = doc->removeSelection( TQTextDocument::Standard ); + doc->setSelectionStart( TQTextDocument::Standard, *cursor ); + } else { + doc->setSelectionStart( TQTextDocument::Standard, *cursor ); + } + // start with 1 as we don't want to remove the Standard-Selection + for ( int i = 1; i < doc->numSelections(); ++i ) + redraw = doc->removeSelection( i ) || redraw; + if ( !redraw ) { + drawCursor( TRUE ); + } else { + repaintChanged(); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( ibeamCursor ); +#endif + } + d->clipboard_mode = TQClipboard::Selection; + paste(); + d->clipboard_mode = TQClipboard::Clipboard; + } + } +#endif + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); + if ( oldCursor != *cursor ) + updateCurrentFormat(); + inDoubleClick = FALSE; + +#ifndef TQT_NO_NETWORKPROTOCOL + if ( ( (!onLink.isEmpty() && onLink == pressedLink) + || (!d->onName.isEmpty() && d->onName == d->pressedName)) + && linksEnabled() && mouseWasPressed ) { + if (!onLink.isEmpty()) { + TQUrl u( doc->context(), onLink, TRUE ); + emitLinkClicked( u.toString( FALSE, FALSE ) ); + } + if (::tqt_cast<TQTextBrowser*>(this)) { // change for 4.0 + TQConnectionList *clist = receivers( + "anchorClicked(const TQString&,const TQString&)"); + if (!signalsBlocked() && clist) { + TQUObject o[3]; + static_QUType_TQString.set(o+1, d->onName); + static_QUType_TQString.set(o+2, onLink); + activate_signal( clist, o); + } + } + + // emitting linkClicked() may result in that the cursor winds + // up hovering over a different valid link - check this and + // set the appropriate cursor shape + updateCursor( e->pos() ); + } +#endif + drawCursor( TRUE ); + if ( !doc->hasSelection( TQTextDocument::Standard, TRUE ) ) + doc->removeSelection( TQTextDocument::Standard ); + + emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); + emit selectionChanged(); +} + +/*! + \reimp +*/ + +void TQTextEdit::contentsMouseDoubleClickEvent( TQMouseEvent * e ) +{ + if ( e->button() != TQt::LeftButton && !d->composeMode() ) { + e->ignore(); + return; + } + int para = 0; + int index = charAt( e->pos(), ¶ ); +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + TQString str = d->od->lines[ LOGOFFSET(para) ]; + int startIdx = index, endIdx = index, i; + if ( !str[ index ].isSpace() ) { + i = startIdx; + // find start of word + while ( i >= 0 && !str[ i ].isSpace() ) { + startIdx = i--; + } + i = endIdx; + // find end of word.. + while ( (uint) i < str.length() && !str[ i ].isSpace() ) { + endIdx = ++i; + } + // ..and start of next + while ( (uint) i < str.length() && str[ i ].isSpace() ) { + endIdx = ++i; + } + optimSetSelection( para, startIdx, para, endIdx ); + repaintContents( FALSE ); + } + } else +#endif + { + if ( sendMouseEventToInputContext( e ) ) + return; + + TQTextCursor c1 = *cursor; + TQTextCursor c2 = *cursor; +#if defined(Q_OS_MAC) + TQTextParagraph *para = cursor->paragraph(); + if ( cursor->isValid() ) { + if ( para->at( cursor->index() )->c.isLetterOrNumber() ) { + while ( c1.index() > 0 && + c1.paragraph()->at( c1.index()-1 )->c.isLetterOrNumber() ) + c1.gotoPreviousLetter(); + while ( c2.paragraph()->at( c2.index() )->c.isLetterOrNumber() && + !c2.atParagEnd() ) + c2.gotoNextLetter(); + } else if ( para->at( cursor->index() )->c.isSpace() ) { + while ( c1.index() > 0 && + c1.paragraph()->at( c1.index()-1 )->c.isSpace() ) + c1.gotoPreviousLetter(); + while ( c2.paragraph()->at( c2.index() )->c.isSpace() && + !c2.atParagEnd() ) + c2.gotoNextLetter(); + } else if ( !c2.atParagEnd() ) { + c2.gotoNextLetter(); + } + } +#else + if ( cursor->index() > 0 && !cursor->paragraph()->at( cursor->index()-1 )->c.isSpace() ) + c1.gotoPreviousWord(); + if ( !cursor->paragraph()->at( cursor->index() )->c.isSpace() && !cursor->atParagEnd() ) + c2.gotoNextWord(); +#endif + doc->setSelectionStart( TQTextDocument::Standard, c1 ); + doc->setSelectionEnd( TQTextDocument::Standard, c2 ); + + *cursor = c2; + + repaintChanged(); + + d->trippleClickTimer->start( tqApp->doubleClickInterval(), TRUE ); + d->trippleClickPoint = e->globalPos(); + } + inDoubleClick = TRUE; + mousePressed = TRUE; + emit doubleClicked( para, index ); +} + +#ifndef TQT_NO_DRAGANDDROP + +/*! + \reimp +*/ + +void TQTextEdit::contentsDragEnterEvent( TQDragEnterEvent *e ) +{ + if ( isReadOnly() || !TQTextDrag::canDecode( e ) ) { + e->ignore(); + return; + } + e->acceptAction(); + inDnD = TRUE; +} + +/*! + \reimp +*/ + +void TQTextEdit::contentsDragMoveEvent( TQDragMoveEvent *e ) +{ + if ( isReadOnly() || !TQTextDrag::canDecode( e ) ) { + e->ignore(); + return; + } + drawCursor( FALSE ); + placeCursor( e->pos(), cursor ); + drawCursor( TRUE ); + e->acceptAction(); +} + +/*! + \reimp +*/ + +void TQTextEdit::contentsDragLeaveEvent( TQDragLeaveEvent * ) +{ + drawCursor( FALSE ); + inDnD = FALSE; +} + +/*! + \reimp +*/ + +void TQTextEdit::contentsDropEvent( TQDropEvent *e ) +{ + if ( isReadOnly() ) + return; + inDnD = FALSE; + e->acceptAction(); + bool intern = FALSE; + if ( TQRichTextDrag::canDecode( e ) ) { + bool hasSel = doc->hasSelection( TQTextDocument::Standard ); + bool internalDrag = e->source() == this || e->source() == viewport(); + int dropId, dropIndex; + TQTextCursor insertCursor = *cursor; + dropId = cursor->paragraph()->paragId(); + dropIndex = cursor->index(); + if ( hasSel && internalDrag ) { + TQTextCursor c1, c2; + int selStartId, selStartIndex; + int selEndId, selEndIndex; + c1 = doc->selectionStartCursor( TQTextDocument::Standard ); + c1.restoreState(); + c2 = doc->selectionEndCursor( TQTextDocument::Standard ); + c2.restoreState(); + selStartId = c1.paragraph()->paragId(); + selStartIndex = c1.index(); + selEndId = c2.paragraph()->paragId(); + selEndIndex = c2.index(); + if ( ( ( dropId > selStartId ) || + ( dropId == selStartId && dropIndex > selStartIndex ) ) && + ( ( dropId < selEndId ) || + ( dropId == selEndId && dropIndex <= selEndIndex ) ) ) + insertCursor = c1; + if ( dropId == selEndId && dropIndex > selEndIndex ) { + insertCursor = c1; + if ( selStartId == selEndId ) { + insertCursor.setIndex( dropIndex - + ( selEndIndex - selStartIndex ) ); + } else { + insertCursor.setIndex( dropIndex - selEndIndex + + selStartIndex ); + } + } + } + + if ( internalDrag && e->action() == TQDropEvent::Move ) { + removeSelectedText(); + intern = TRUE; + doc->removeSelection( TQTextDocument::Standard ); + } else { + doc->removeSelection( TQTextDocument::Standard ); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + } + drawCursor( FALSE ); + cursor->setParagraph( insertCursor.paragraph() ); + cursor->setIndex( insertCursor.index() ); + drawCursor( TRUE ); + if ( !cursor->nestedDepth() ) { + TQString subType = "plain"; + if ( textFormat() != PlainText ) { + if ( e->provides( "application/x-qrichtext" ) ) + subType = "x-qrichtext"; + } +#ifndef TQT_NO_CLIPBOARD + pasteSubType( subType.latin1(), e ); +#endif + // emit appropriate signals. + emit selectionChanged(); + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); + } else { + if ( intern ) + undo(); + e->ignore(); + } + } +} + +#endif + +/*! + \reimp +*/ +void TQTextEdit::contentsContextMenuEvent( TQContextMenuEvent *e ) +{ + e->accept(); +#ifndef TQT_NO_IM + if ( d->composeMode() ) + return; +#endif + + clearUndoRedo(); + mousePressed = FALSE; + +#ifndef TQT_NO_POPUPMENU + TQGuardedPtr<TQTextEdit> that = this; + TQGuardedPtr<TQPopupMenu> popup = createPopupMenu( e->pos() ); + if ( !popup ) + popup = createPopupMenu(); + if ( !popup ) + return; + + int r = popup->exec( e->globalPos() ); + delete popup; + if (!that) + return; + + if ( r == d->id[ IdClear ] ) + clear(); + else if ( r == d->id[ IdSelectAll ] ) { + selectAll(); +#ifndef TQT_NO_CLIPBOARD + // if the clipboard support selections, put the newly selected text into + // the clipboard + if (TQApplication::clipboard()->supportsSelection()) { + d->clipboard_mode = TQClipboard::Selection; + + // don't listen to selection changes + disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), this, 0); + copy(); + // listen to selection changes + connect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), + this, TQ_SLOT(clipboardChanged()) ); + + d->clipboard_mode = TQClipboard::Clipboard; + } +#endif + } else if ( r == d->id[ IdUndo ] ) + undo(); + else if ( r == d->id[ IdRedo ] ) + redo(); +#ifndef TQT_NO_CLIPBOARD + else if ( r == d->id[ IdCut ] ) + cut(); + else if ( r == d->id[ IdCopy ] ) + copy(); + else if ( r == d->id[ IdPaste ] ) + paste(); +#endif +#endif +} + + +void TQTextEdit::autoScrollTimerDone() +{ + if ( mousePressed ) + handleMouseMove( viewportToContents( viewport()->mapFromGlobal( TQCursor::pos() ) ) ); +} + +void TQTextEdit::handleMouseMove( const TQPoint& pos ) +{ + if ( !mousePressed ) + return; + + if ( (!scrollTimer->isActive() && pos.y() < contentsY()) || pos.y() > contentsY() + visibleHeight() ) + scrollTimer->start( 100, FALSE ); + else if ( scrollTimer->isActive() && pos.y() >= contentsY() && pos.y() <= contentsY() + visibleHeight() ) + scrollTimer->stop(); + + drawCursor( FALSE ); + TQTextCursor oldCursor = *cursor; + + placeCursor( pos ); + + if ( inDoubleClick ) { + TQTextCursor cl = *cursor; + cl.gotoPreviousWord(); + TQTextCursor cr = *cursor; + cr.gotoNextWord(); + + int diff = TQABS( oldCursor.paragraph()->at( oldCursor.index() )->x - mousePos.x() ); + int ldiff = TQABS( cl.paragraph()->at( cl.index() )->x - mousePos.x() ); + int rdiff = TQABS( cr.paragraph()->at( cr.index() )->x - mousePos.x() ); + + + if ( cursor->paragraph()->lineStartOfChar( cursor->index() ) != + oldCursor.paragraph()->lineStartOfChar( oldCursor.index() ) ) + diff = 0xFFFFFF; + + if ( rdiff < diff && rdiff < ldiff ) + *cursor = cr; + else if ( ldiff < diff && ldiff < rdiff ) + *cursor = cl; + else + *cursor = oldCursor; + + } + ensureCursorVisible(); + + bool redraw = FALSE; + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + redraw = doc->setSelectionEnd( TQTextDocument::Standard, *cursor ) || redraw; + } + + if ( !redraw ) { + drawCursor( TRUE ); + } else { + repaintChanged(); + drawCursor( TRUE ); + } + + if ( currentFormat && currentFormat->key() != cursor->paragraph()->at( cursor->index() )->format()->key() ) { + currentFormat->removeRef(); + currentFormat = doc->formatCollection()->format( cursor->paragraph()->at( cursor->index() )->format() ); + if ( currentFormat->isMisspelled() ) { + currentFormat->removeRef(); + currentFormat = doc->formatCollection()->format( currentFormat->font(), currentFormat->color() ); + } + emit currentFontChanged( currentFormat->font() ); + emit currentColorChanged( currentFormat->color() ); + emit currentVerticalAlignmentChanged( (VerticalAlignment)currentFormat->vAlign() ); + } + + if ( currentAlignment != cursor->paragraph()->alignment() ) { + currentAlignment = cursor->paragraph()->alignment(); + block_set_alignment = TRUE; + emit currentAlignmentChanged( currentAlignment ); + block_set_alignment = FALSE; + } +} + +/*! \internal */ + +void TQTextEdit::placeCursor( const TQPoint &pos, TQTextCursor *c, bool link ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return; +#endif + if ( !c ) + c = cursor; + + resetInputContext(); + c->restoreState(); + TQTextParagraph *s = doc->firstParagraph(); + c->place( pos, s, link ); + updateMicroFocusHint(); +} + + +void TQTextEdit::updateMicroFocusHint() +{ + TQTextCursor c( *cursor ); +#if 0 + // Disabled for Asian input method that shows candidate + // window. This behavior is same as TQt/E 2.3.7 which supports + // Asian input methods. Asian input methods need start point of IM + // selection text to place candidate window as adjacent to the + // selection text. + if ( d->preeditStart != -1 ) { + c.setIndex( d->preeditStart ); + if(doc->hasSelection(TQTextDocument::IMSelectionText)) { + int para, index; + doc->selectionStart(TQTextDocument::IMSelectionText, para, index); + c.setIndex(index); + } + } +#endif + + if ( hasFocus() || viewport()->hasFocus() ) { + int h = c.paragraph()->lineHeightOfChar( cursor->index() ); + if ( !readOnly ) { + TQFont f = c.paragraph()->at( c.index() )->format()->font(); + setMicroFocusHint( c.x() - contentsX() + frameWidth(), + c.y() + cursor->paragraph()->rect().y() - contentsY() + frameWidth(), 0, h, TRUE, &f ); + } + } +} + + + +void TQTextEdit::formatMore() +{ + if ( !lastFormatted ) + return; + + int bottom = contentsHeight(); + int lastTop = -1; + int lastBottom = -1; + int to = 20; + bool firstVisible = FALSE; + TQRect cr( contentsX(), contentsY(), visibleWidth(), visibleHeight() ); + for ( int i = 0; lastFormatted && + ( i < to || ( firstVisible && lastTop < contentsY()+height() ) ); + i++ ) { + lastFormatted->format(); + lastTop = lastFormatted->rect().top(); + lastBottom = lastFormatted->rect().bottom(); + if ( i == 0 ) + firstVisible = lastBottom < cr.bottom(); + bottom = TQMAX( bottom, lastBottom ); + lastFormatted = lastFormatted->next(); + } + + if ( bottom > contentsHeight() ) { + resizeContents( contentsWidth(), TQMAX( doc->height(), bottom ) ); + } else if ( !lastFormatted && lastBottom < contentsHeight() ) { + resizeContents( contentsWidth(), TQMAX( doc->height(), lastBottom ) ); + if ( contentsHeight() < visibleHeight() ) + updateContents( 0, contentsHeight(), visibleWidth(), + visibleHeight() - contentsHeight() ); + } + + if ( lastFormatted ) + formatTimer->start( interval, TRUE ); + else + interval = TQMAX( 0, interval ); +} + +void TQTextEdit::doResize() +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( !d->optimMode ) +#endif + { + if ( wrapMode == FixedPixelWidth ) + return; + doc->setMinimumWidth( -1 ); + resizeContents( 0, 0 ); + doc->setWidth( visibleWidth() ); + doc->invalidate(); + lastFormatted = doc->firstParagraph(); + interval = 0; + formatMore(); + } + repaintContents( FALSE ); +} + +/*! \internal */ + +void TQTextEdit::doChangeInterval() +{ + interval = 0; +} + +/*! + \reimp +*/ + +bool TQTextEdit::eventFilter( TQObject *o, TQEvent *e ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( !d->optimMode && (o == this || o == viewport()) ) { +#else + if ( o == this || o == viewport() ) { +#endif + if ( e->type() == TQEvent::FocusIn ) { + if ( TQApplication::cursorFlashTime() > 0 ) + blinkTimer->start( TQApplication::cursorFlashTime() / 2 ); + drawCursor( TRUE ); + updateMicroFocusHint(); + } else if ( e->type() == TQEvent::FocusOut ) { + blinkTimer->stop(); + drawCursor( FALSE ); + } + } + + if ( o == this && e->type() == TQEvent::PaletteChange ) { + TQColor old( viewport()->colorGroup().color( TQColorGroup::Text ) ); + if ( old != colorGroup().color( TQColorGroup::Text ) ) { + TQColor c( colorGroup().color( TQColorGroup::Text ) ); + doc->setMinimumWidth( -1 ); + doc->setDefaultFormat( doc->formatCollection()->defaultFormat()->font(), c ); + lastFormatted = doc->firstParagraph(); + formatMore(); + repaintChanged(); + } + } + + return TQScrollView::eventFilter( o, e ); +} + +/*! + \obsolete + */ +void TQTextEdit::insert( const TQString &text, bool indent, + bool checkNewLine, bool removeSelected ) +{ + uint f = 0; + if ( indent ) + f |= RedoIndentation; + if ( checkNewLine ) + f |= CheckNewLines; + if ( removeSelected ) + f |= RemoveSelected; + insert( text, f ); +} + +/*! + Inserts \a text at the current cursor position. + + The \a insertionFlags define how the text is inserted. If \c + RedoIndentation is set, the paragraph is re-indented. If \c + CheckNewLines is set, newline characters in \a text result in hard + line breaks (i.e. new paragraphs). If \c checkNewLine is not set, + the behaviour of the editor is undefined if the \a text contains + newlines. (It is not possible to change TQTextEdit's newline handling + behavior, but you can use TQString::replace() to preprocess text + before inserting it.) If \c RemoveSelected is set, any selected + text (in selection 0) is removed before the text is inserted. + + The default flags are \c CheckNewLines | \c RemoveSelected. + + If the widget is in \c LogText mode this function will do nothing. + + \sa paste() pasteSubType() +*/ + + +void TQTextEdit::insert( const TQString &text, uint insertionFlags ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return; +#endif + + if ( cursor->nestedDepth() != 0 ) // #### for 3.0, disable editing of tables as this is not advanced enough + return; + + bool indent = insertionFlags & RedoIndentation; + bool checkNewLine = insertionFlags & CheckNewLines; + bool removeSelected = insertionFlags & RemoveSelected; + bool imComposition = insertionFlags & AsIMCompositionText; + bool imSelection = insertionFlags & WithIMSelection; + TQString txt( text ); + drawCursor( FALSE ); + if ( !isReadOnly() && doc->hasSelection( TQTextDocument::Standard ) && removeSelected ) + removeSelectedText(); + TQTextCursor c2 = *cursor; + int oldLen = 0; + + if ( undoEnabled && !isReadOnly() && undoRedoInfo.type != UndoRedoInfo::IME ) { + checkUndoRedoInfo( UndoRedoInfo::Insert ); + + if (undoRedoInfo.valid() && undoRedoInfo.index + undoRedoInfo.d->text.length() != cursor->index()) { + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Insert; + } + + if ( !undoRedoInfo.valid() ) { + undoRedoInfo.id = cursor->paragraph()->paragId(); + undoRedoInfo.index = cursor->index(); + undoRedoInfo.d->text = TQString::null; + } + oldLen = undoRedoInfo.d->text.length(); + } + + lastFormatted = checkNewLine && cursor->paragraph()->prev() ? + cursor->paragraph()->prev() : cursor->paragraph(); + TQTextCursor oldCursor = *cursor; + cursor->insert( txt, checkNewLine ); + if ( doc->useFormatCollection() && !doc->preProcessor() ) { + doc->setSelectionStart( TQTextDocument::Temp, oldCursor ); + doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); + doc->setFormat( TQTextDocument::Temp, currentFormat, TQTextFormat::Format ); + doc->removeSelection( TQTextDocument::Temp ); + } + + if ( indent && ( txt == "{" || txt == "}" || txt == ":" || txt == "#" ) ) + cursor->indent(); + formatMore(); + repaintChanged(); + ensureCursorVisible(); + // Asian users regard selection text as cursor on candidate + // selection phase of input method, so ordinary cursor should be + // invisible if IM selection text exists. + drawCursor( !imSelection ); + + if ( undoEnabled && !isReadOnly() && undoRedoInfo.type != UndoRedoInfo::IME ) { + undoRedoInfo.d->text += txt; + if ( !doc->preProcessor() ) { + for ( int i = 0; i < (int)txt.length(); ++i ) { + if ( txt[ i ] != '\n' && c2.paragraph()->at( c2.index() )->format() ) { + c2.paragraph()->at( c2.index() )->format()->addRef(); + undoRedoInfo.d->text. + setFormat( oldLen + i, + c2.paragraph()->at( c2.index() )->format(), TRUE ); + } + c2.gotoNextLetter(); + } + } + } + + if ( !removeSelected ) { + doc->setSelectionStart( TQTextDocument::Standard, oldCursor ); + doc->setSelectionEnd( TQTextDocument::Standard, *cursor ); + repaintChanged(); + } + // updateMicroFocusHint() should not be invoked here when this + // function is invoked from imComposeEvent() because cursor + // postion is incorrect yet. imComposeEvent() invokes + // updateMicroFocusHint() later. + if ( !imComposition ) { + updateMicroFocusHint(); + } + setModified(); + emit textChanged(); +} + +/*! + Inserts \a text in the paragraph \a para at position \a index. +*/ + +void TQTextEdit::insertAt( const TQString &text, int para, int index ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimInsert( text, para, index ); + return; + } +#endif + resetInputContext(); + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return; + removeSelection( TQTextDocument::Standard ); + TQTextCursor tmp = *cursor; + cursor->setParagraph( p ); + cursor->setIndex( index ); + insert( text, FALSE, TRUE, FALSE ); + *cursor = tmp; + removeSelection( TQTextDocument::Standard ); +} + +/*! + Inserts \a text as a new paragraph at position \a para. If \a para + is -1, the text is appended. Use append() if the append operation + is performance critical. +*/ + +void TQTextEdit::insertParagraph( const TQString &text, int para ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimInsert( text + "\n", para, 0 ); + return; + } +#endif + resetInputContext(); + for ( int i = 0; i < (int)doc->numSelections(); ++i ) + doc->removeSelection( i ); + + TQTextParagraph *p = doc->paragAt( para ); + + bool append = !p; + if ( !p ) + p = doc->lastParagraph(); + + TQTextCursor old = *cursor; + drawCursor( FALSE ); + + cursor->setParagraph( p ); + cursor->setIndex( 0 ); + clearUndoRedo(); + tqtextedit_ignore_readonly = TRUE; + if ( append && cursor->paragraph()->length() > 1 ) { + cursor->setIndex( cursor->paragraph()->length() - 1 ); + doKeyboardAction( ActionReturn ); + } + insert( text, FALSE, TRUE, TRUE ); + doKeyboardAction( ActionReturn ); + tqtextedit_ignore_readonly = FALSE; + + drawCursor( FALSE ); + *cursor = old; + drawCursor( TRUE ); + + repaintChanged(); +} + +/*! + Removes the paragraph \a para. +*/ + +void TQTextEdit::removeParagraph( int para ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return; +#endif + resetInputContext(); + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return; + + for ( int i = 0; i < doc->numSelections(); ++i ) + doc->removeSelection( i ); + + TQTextCursor start( doc ); + TQTextCursor end( doc ); + start.setParagraph( p ); + start.setIndex( 0 ); + end.setParagraph( p ); + end.setIndex( p->length() - 1 ); + + if ( !(p == doc->firstParagraph() && p == doc->lastParagraph()) ) { + if ( p->next() ) { + end.setParagraph( p->next() ); + end.setIndex( 0 ); + } else if ( p->prev() ) { + start.setParagraph( p->prev() ); + start.setIndex( p->prev()->length() - 1 ); + } + } + + doc->setSelectionStart( TQTextDocument::Temp, start ); + doc->setSelectionEnd( TQTextDocument::Temp, end ); + removeSelectedText( TQTextDocument::Temp ); +} + +/*! + Undoes the last operation. + + If there is no operation to undo, i.e. there is no undo step in + the undo/redo history, nothing happens. + + \sa undoAvailable() redo() undoDepth() +*/ + +void TQTextEdit::undo() +{ + clearUndoRedo(); + if ( isReadOnly() || !doc->commands()->isUndoAvailable() || !undoEnabled ) + return; + + resetInputContext(); + for ( int i = 0; i < (int)doc->numSelections(); ++i ) + doc->removeSelection( i ); + +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + + clearUndoRedo(); + drawCursor( FALSE ); + TQTextCursor *c = doc->undo( cursor ); + if ( !c ) { + drawCursor( TRUE ); + return; + } + lastFormatted = 0; + repaintChanged(); + ensureCursorVisible(); + drawCursor( TRUE ); + updateMicroFocusHint(); + setModified(); + // ### If we get back to a completely blank textedit, it + // is possible that cursor is invalid and further actions + // might not fix the problem, so reset the cursor here. + // This is copied from removeSeletedText(), it might be + // okay to just call that. + if ( !cursor->isValid() ) { + delete cursor; + cursor = new TQTextCursor( doc ); + drawCursor( TRUE ); + repaintContents( TRUE ); + } + emit undoAvailable( isUndoAvailable() ); + emit redoAvailable( isRedoAvailable() ); + emit textChanged(); +} + +/*! + Redoes the last operation. + + If there is no operation to redo, i.e. there is no redo step in + the undo/redo history, nothing happens. + + \sa redoAvailable() undo() undoDepth() +*/ + +void TQTextEdit::redo() +{ + if ( isReadOnly() || !doc->commands()->isRedoAvailable() || !undoEnabled ) + return; + + resetInputContext(); + for ( int i = 0; i < (int)doc->numSelections(); ++i ) + doc->removeSelection( i ); + +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + + clearUndoRedo(); + drawCursor( FALSE ); + TQTextCursor *c = doc->redo( cursor ); + if ( !c ) { + drawCursor( TRUE ); + return; + } + lastFormatted = 0; + ensureCursorVisible(); + repaintChanged(); + ensureCursorVisible(); + drawCursor( TRUE ); + updateMicroFocusHint(); + setModified(); + emit undoAvailable( isUndoAvailable() ); + emit redoAvailable( isRedoAvailable() ); + emit textChanged(); +} + +/*! + Pastes the text from the clipboard into the text edit at the + current cursor position. Only plain text is pasted. + + If there is no text in the clipboard nothing happens. + + \sa pasteSubType() cut() TQTextEdit::copy() +*/ + +void TQTextEdit::paste() +{ +#ifndef TQT_NO_MIMECLIPBOARD + if ( isReadOnly() ) + return; + TQString subType = "plain"; + if ( textFormat() != PlainText ) { + TQMimeSource *m = TQApplication::clipboard()->data( d->clipboard_mode ); + if ( !m ) + return; + if ( m->provides( "application/x-qrichtext" ) ) + subType = "x-qrichtext"; + } + + pasteSubType( subType.latin1() ); + updateMicroFocusHint(); +#endif +} + +void TQTextEdit::checkUndoRedoInfo( UndoRedoInfo::Type t ) +{ + if ( undoRedoInfo.valid() && t != undoRedoInfo.type ) { + clearUndoRedo(); + } + undoRedoInfo.type = t; +} + +/*! + Repaints any paragraphs that have changed. + + Although used extensively internally you shouldn't need to call + this yourself. +*/ + +void TQTextEdit::repaintChanged() +{ + if ( !isUpdatesEnabled() || !viewport()->isUpdatesEnabled() ) + return; + + TQPainter p( viewport() ); +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimDrawContents( &p, contentsX(), contentsY(), visibleWidth(), visibleHeight() ); + return; + } +#endif + p.translate( -contentsX(), -contentsY() ); + paintDocument( FALSE, &p, contentsX(), contentsY(), visibleWidth(), visibleHeight() ); +} + +#ifndef TQT_NO_MIME +TQTextDrag *TQTextEdit::dragObject( TQWidget *parent ) const +{ + if ( !doc->hasSelection( TQTextDocument::Standard ) || + doc->selectedText( TQTextDocument::Standard ).isEmpty() ) + return 0; + if ( textFormat() != RichText ) + return new TQTextDrag( doc->selectedText( TQTextDocument::Standard ), parent ); + TQRichTextDrag *drag = new TQRichTextDrag( parent ); + drag->setPlainText( doc->selectedText( TQTextDocument::Standard ) ); + drag->setRichText( doc->selectedText( TQTextDocument::Standard, TRUE ) ); + return drag; +} +#endif + +/*! + Copies the selected text (from selection 0) to the clipboard and + deletes it from the text edit. + + If there is no selected text (in selection 0) nothing happens. + + \sa TQTextEdit::copy() paste() pasteSubType() +*/ + +void TQTextEdit::cut() +{ + if ( isReadOnly() ) + return; + resetInputContext(); + normalCopy(); + removeSelectedText(); + updateMicroFocusHint(); +} + +void TQTextEdit::normalCopy() +{ +#ifndef TQT_NO_MIME + TQTextDrag *drag = dragObject(); + if ( !drag ) + return; +#ifndef TQT_NO_MIMECLIPBOARD + TQApplication::clipboard()->setData( drag, d->clipboard_mode ); +#endif // TQT_NO_MIMECLIPBOARD +#endif // TQT_NO_MIME +} + +/*! + Copies any selected text (from selection 0) to the clipboard. + + \sa hasSelectedText() copyAvailable() +*/ + +void TQTextEdit::copy() +{ +#ifndef TQT_NO_CLIPBOARD +# ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode && optimHasSelection() ) + TQApplication::clipboard()->setText( optimSelectedText(), d->clipboard_mode ); + else + normalCopy(); +# else + normalCopy(); +# endif +#endif +} + +/*! + \internal + + Re-indents the current paragraph. +*/ + +void TQTextEdit::indent() +{ + if ( isReadOnly() ) + return; + + drawCursor( FALSE ); + if ( !doc->hasSelection( TQTextDocument::Standard ) ) + cursor->indent(); + else + doc->indentSelection( TQTextDocument::Standard ); + repaintChanged(); + drawCursor( TRUE ); + setModified(); + emit textChanged(); +} + +/*! + Reimplemented to allow tabbing through links. If \a n is TRUE the + tab moves the focus to the next child; if \a n is FALSE the tab + moves the focus to the previous child. Returns TRUE if the focus + was moved; otherwise returns FALSE. + */ + +bool TQTextEdit::focusNextPrevChild( bool n ) +{ + if ( !isReadOnly() || !linksEnabled() ) + return FALSE; + bool b = doc->focusNextPrevChild( n ); + repaintChanged(); + if ( b ) { + TQTextParagraph *p = doc->focusIndicator.parag; + int start = doc->focusIndicator.start; + int len = doc->focusIndicator.len; + + int y = p->rect().y(); + while ( p + && len == 0 + && p->at( start )->isCustom() + && p->at( start )->customItem()->isNested() ) { + + TQTextTable *t = (TQTextTable*)p->at( start )->customItem(); + TQPtrList<TQTextTableCell> cells = t->tableCells(); + TQTextTableCell *c; + for ( c = cells.first(); c; c = cells.next() ) { + TQTextDocument *cellDoc = c->richText(); + if ( cellDoc->hasFocusParagraph() ) { + y += c->geometry().y() + c->verticalAlignmentOffset(); + + p = cellDoc->focusIndicator.parag; + start = cellDoc->focusIndicator.start; + len = cellDoc->focusIndicator.len; + if ( p ) + y += p->rect().y(); + + break; + } + } + } + setContentsPos( contentsX(), TQMIN( y, contentsHeight() - visibleHeight() ) ); + } + return b; +} + +/*! + \internal + + This functions sets the current format to \a f. Only the fields of \a + f which are specified by the \a flags are used. +*/ + +void TQTextEdit::setFormat( TQTextFormat *f, int flags ) +{ + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + drawCursor( FALSE ); + TQTextCursor c1 = doc->selectionStartCursor( TQTextDocument::Standard ); + c1.restoreState(); + TQTextCursor c2 = doc->selectionEndCursor( TQTextDocument::Standard ); + c2.restoreState(); + if ( undoEnabled ) { + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Format; + undoRedoInfo.id = c1.paragraph()->paragId(); + undoRedoInfo.index = c1.index(); + undoRedoInfo.eid = c2.paragraph()->paragId(); + undoRedoInfo.eindex = c2.index(); + readFormats( c1, c2, undoRedoInfo.d->text ); + undoRedoInfo.format = f; + undoRedoInfo.flags = flags; + clearUndoRedo(); + } + doc->setFormat( TQTextDocument::Standard, f, flags ); + repaintChanged(); + formatMore(); + drawCursor( TRUE ); + setModified(); + emit textChanged(); + } + if ( currentFormat && currentFormat->key() != f->key() ) { + currentFormat->removeRef(); + currentFormat = doc->formatCollection()->format( f ); + if ( currentFormat->isMisspelled() ) { + currentFormat->removeRef(); + currentFormat = doc->formatCollection()->format( currentFormat->font(), + currentFormat->color() ); + } + emit currentFontChanged( currentFormat->font() ); + emit currentColorChanged( currentFormat->color() ); + emit currentVerticalAlignmentChanged( (VerticalAlignment)currentFormat->vAlign() ); + if ( cursor->index() == cursor->paragraph()->length() - 1 ) { + currentFormat->addRef(); + cursor->paragraph()->string()->setFormat( cursor->index(), currentFormat, TRUE ); + if ( cursor->paragraph()->length() == 1 ) { + cursor->paragraph()->invalidate( 0 ); + cursor->paragraph()->format(); + repaintChanged(); + } + } + } +} + +/*! + \reimp +*/ + +void TQTextEdit::setPalette( const TQPalette &p ) +{ + TQScrollView::setPalette( p ); + if ( textFormat() == PlainText ) { + TQTextFormat *f = doc->formatCollection()->defaultFormat(); + f->setColor( colorGroup().text() ); + updateContents(); + } +} + +/*! \internal + \warning In TQt 3.1 we will provide a cleaer API for the + functionality which is provided by this function and in TQt 4.0 this + function will go away. + + Sets the paragraph style of the current paragraph + to \a dm. If \a dm is TQStyleSheetItem::DisplayListItem, the + type of the list item is set to \a listStyle. + + \sa setAlignment() +*/ + +void TQTextEdit::setParagType( TQStyleSheetItem::DisplayMode dm, + TQStyleSheetItem::ListStyle listStyle ) +{ + if ( isReadOnly() ) + return; + + drawCursor( FALSE ); + TQTextParagraph *start = cursor->paragraph(); + TQTextParagraph *end = start; + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + start = doc->selectionStartCursor( TQTextDocument::Standard ).topParagraph(); + end = doc->selectionEndCursor( TQTextDocument::Standard ).topParagraph(); + if ( end->paragId() < start->paragId() ) + return; // do not trust our selections + } + + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Style; + undoRedoInfo.id = start->paragId(); + undoRedoInfo.eid = end->paragId(); + undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); + + while ( start != end->next() ) { + start->setListStyle( listStyle ); + if ( dm == TQStyleSheetItem::DisplayListItem ) { + start->setListItem( TRUE ); + if( start->listDepth() == 0 ) + start->setListDepth( 1 ); + } else if ( start->isListItem() ) { + start->setListItem( FALSE ); + start->setListDepth( TQMAX( start->listDepth()-1, 0 ) ); + } + start = start->next(); + } + + clearUndoRedo(); + repaintChanged(); + formatMore(); + drawCursor( TRUE ); + setModified(); + emit textChanged(); +} + +/*! + Sets the alignment of the current paragraph to \a a. Valid + alignments are \c TQt::AlignLeft, \c TQt::AlignRight, + \c TQt::AlignJustify and \c TQt::AlignCenter (which centers + horizontally). +*/ + +void TQTextEdit::setAlignment( int a ) +{ + if ( isReadOnly() || block_set_alignment ) + return; + + drawCursor( FALSE ); + TQTextParagraph *start = cursor->paragraph(); + TQTextParagraph *end = start; + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + start = doc->selectionStartCursor( TQTextDocument::Standard ).topParagraph(); + end = doc->selectionEndCursor( TQTextDocument::Standard ).topParagraph(); + if ( end->paragId() < start->paragId() ) + return; // do not trust our selections + } + + clearUndoRedo(); + undoRedoInfo.type = UndoRedoInfo::Style; + undoRedoInfo.id = start->paragId(); + undoRedoInfo.eid = end->paragId(); + undoRedoInfo.styleInformation = TQTextStyleCommand::readStyleInformation( doc, undoRedoInfo.id, undoRedoInfo.eid ); + + while ( start != end->next() ) { + start->setAlignment( a ); + start = start->next(); + } + + clearUndoRedo(); + repaintChanged(); + formatMore(); + drawCursor( TRUE ); + if ( currentAlignment != a ) { + currentAlignment = a; + emit currentAlignmentChanged( currentAlignment ); + } + setModified(); + emit textChanged(); +} + +void TQTextEdit::updateCurrentFormat() +{ + int i = cursor->index(); + if ( i > 0 ) + --i; + if ( doc->useFormatCollection() && + ( !currentFormat || currentFormat->key() != cursor->paragraph()->at( i )->format()->key() ) ) { + if ( currentFormat ) + currentFormat->removeRef(); + currentFormat = doc->formatCollection()->format( cursor->paragraph()->at( i )->format() ); + if ( currentFormat->isMisspelled() ) { + currentFormat->removeRef(); + currentFormat = doc->formatCollection()->format( currentFormat->font(), currentFormat->color() ); + } + emit currentFontChanged( currentFormat->font() ); + emit currentColorChanged( currentFormat->color() ); + emit currentVerticalAlignmentChanged( (VerticalAlignment)currentFormat->vAlign() ); + } + + if ( currentAlignment != cursor->paragraph()->alignment() ) { + currentAlignment = cursor->paragraph()->alignment(); + block_set_alignment = TRUE; + emit currentAlignmentChanged( currentAlignment ); + block_set_alignment = FALSE; + } +} + +/*! + If \a b is TRUE sets the current format to italic; otherwise sets + the current format to non-italic. + + \sa italic() +*/ + +void TQTextEdit::setItalic( bool b ) +{ + TQTextFormat f( *currentFormat ); + f.setItalic( b ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat(f2, TQTextFormat::Italic ); +} + +/*! + If \a b is TRUE sets the current format to bold; otherwise sets + the current format to non-bold. + + \sa bold() +*/ + +void TQTextEdit::setBold( bool b ) +{ + TQTextFormat f( *currentFormat ); + f.setBold( b ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::Bold ); +} + +/*! + If \a b is TRUE sets the current format to underline; otherwise + sets the current format to non-underline. + + \sa underline() +*/ + +void TQTextEdit::setUnderline( bool b ) +{ + TQTextFormat f( *currentFormat ); + f.setUnderline( b ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::Underline ); +} + +/*! + Sets the font family of the current format to \a fontFamily. + + \sa family() setCurrentFont() +*/ + +void TQTextEdit::setFamily( const TQString &fontFamily ) +{ + TQTextFormat f( *currentFormat ); + f.setFamily( fontFamily ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::Family ); +} + +/*! + Sets the point size of the current format to \a s. + + Note that if \a s is zero or negative, the behaviour of this + function is not defined. + + \sa pointSize() setCurrentFont() setFamily() +*/ + +void TQTextEdit::setPointSize( int s ) +{ + TQTextFormat f( *currentFormat ); + f.setPointSize( s ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::Size ); +} + +/*! + Sets the color of the current format, i.e. of the text, to \a c. + + \sa color() setPaper() +*/ + +void TQTextEdit::setColor( const TQColor &c ) +{ + TQTextFormat f( *currentFormat ); + f.setColor( c ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::Color ); +} + +/*! + Sets the vertical alignment of the current format, i.e. of the + text, to \a a. + + \sa color() setPaper() +*/ + +void TQTextEdit::setVerticalAlignment( VerticalAlignment a ) +{ + TQTextFormat f( *currentFormat ); + f.setVAlign( (TQTextFormat::VerticalAlignment)a ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::VAlign ); +} + +void TQTextEdit::setFontInternal( const TQFont &f_ ) +{ + TQTextFormat f( *currentFormat ); + f.setFont( f_ ); + TQTextFormat *f2 = doc->formatCollection()->format( &f ); + setFormat( f2, TQTextFormat::Font ); +} + + +TQString TQTextEdit::text() const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return optimText(); +#endif + + TQTextParagraph *p = doc->firstParagraph(); + if ( !p || (!p->next() && p->length() <= 1) ) + return TQString::fromLatin1(""); + + if ( isReadOnly() ) + return doc->originalText(); + return doc->text(); +} + +/*! + \overload + + Returns the text of paragraph \a para. + + If textFormat() is \c RichText the text will contain HTML + formatting tags. +*/ + +TQString TQTextEdit::text( int para ) const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode && (d->od->numLines >= para) ) { + TQString paraStr = d->od->lines[ LOGOFFSET(para) ]; + if ( paraStr.isEmpty() ) + paraStr = "\n"; + return paraStr; + } else +#endif + return doc->text( para ); +} + +/*! + \overload + + Changes the text of the text edit to the string \a text and the + context to \a context. Any previous text is removed. + + \a text may be interpreted either as plain text or as rich text, + depending on the textFormat(). The default setting is \c AutoText, + i.e. the text edit auto-detects the format from \a text. + + For rich text the rendering style and available tags are defined + by a styleSheet(); see TQStyleSheet for details. + + The optional \a context is a path which the text edit's + TQMimeSourceFactory uses to resolve the locations of files and + images. (See \l{TQTextEdit::TQTextEdit()}.) It is passed to the text + edit's TQMimeSourceFactory when quering data. + + Note that the undo/redo history is cleared by this function. + + \sa text(), setTextFormat() +*/ + +void TQTextEdit::setText( const TQString &text, const TQString &context ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimSetText( text ); + return; + } +#endif + resetInputContext(); + if ( !isModified() && isReadOnly() && + this->context() == context && this->text() == text ) + return; + + emit undoAvailable( FALSE ); + emit redoAvailable( FALSE ); + undoRedoInfo.clear(); + doc->commands()->clear(); + + lastFormatted = 0; + int oldCursorPos = cursor->index(); + int oldCursorPar = cursor->paragraph()->paragId(); + cursor->restoreState(); + delete cursor; + doc->setText( text, context ); + + if ( wrapMode == FixedPixelWidth ) { + resizeContents( wrapWidth, 0 ); + doc->setWidth( wrapWidth ); + doc->setMinimumWidth( wrapWidth ); + } else { + doc->setMinimumWidth( -1 ); + resizeContents( 0, 0 ); + } + + lastFormatted = doc->firstParagraph(); + cursor = new TQTextCursor( doc ); + updateContents(); + + if ( isModified() ) + setModified( FALSE ); + emit textChanged(); + if ( cursor->index() != oldCursorPos || cursor->paragraph()->paragId() != oldCursorPar ) { + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); + } + formatMore(); + updateCurrentFormat(); + d->scrollToAnchor = TQString::null; +} + +/*! + \property TQTextEdit::text + \brief the text edit's text + + There is no default text. + + On setting, any previous text is deleted. + + The text may be interpreted either as plain text or as rich text, + depending on the textFormat(). The default setting is \c AutoText, + i.e. the text edit auto-detects the format of the text. + + For richtext, calling text() on an editable TQTextEdit will cause + the text to be regenerated from the textedit. This may mean that + the TQString returned may not be exactly the same as the one that + was set. + + \sa textFormat +*/ + + +/*! + \property TQTextEdit::readOnly + \brief whether the text edit is read-only + + In a read-only text edit the user can only navigate through the + text and select text; modifying the text is not possible. + + This property's default is FALSE. +*/ + +/*! + Finds the next occurrence of the string, \a expr. Returns TRUE if + \a expr was found; otherwise returns FALSE. + + If \a para and \a index are both 0 the search begins from the + current cursor position. If \a para and \a index are both not 0, + the search begins from the \a *index character position in the + \a *para paragraph. + + If \a cs is TRUE the search is case sensitive, otherwise it is + case insensitive. If \a wo is TRUE the search looks for whole word + matches only; otherwise it searches for any matching text. If \a + forward is TRUE (the default) the search works forward from the + starting position to the end of the text, otherwise it works + backwards to the beginning of the text. + + If \a expr is found the function returns TRUE. If \a index and \a + para are not 0, the number of the paragraph in which the first + character of the match was found is put into \a *para, and the + index position of that character within the paragraph is put into + \a *index. + + If \a expr is not found the function returns FALSE. If \a index + and \a para are not 0 and \a expr is not found, \a *index + and \a *para are undefined. + + Please note that this function will make the next occurrence of + the string (if found) the current selection, and will thus + modify the cursor position. + + Using the \a para and \a index parameters will not work correctly + in case the document contains tables. +*/ + +bool TQTextEdit::find( const TQString &expr, bool cs, bool wo, bool forward, + int *para, int *index ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return optimFind( expr, cs, wo, forward, para, index ); +#endif + drawCursor( FALSE ); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + TQTextCursor findcur = *cursor; + if ( para && index ) { + if ( doc->paragAt( *para ) ) + findcur.gotoPosition( doc->paragAt(*para), *index ); + else + findcur.gotoEnd(); + } else if ( doc->hasSelection( TQTextDocument::Standard ) ){ + // maks sure we do not find the same selection again + if ( forward ) + findcur.gotoNextLetter(); + else + findcur.gotoPreviousLetter(); + } else if (!forward && findcur.index() == 0 && findcur.paragraph() == findcur.topParagraph()) { + findcur.gotoEnd(); + } + removeSelection( TQTextDocument::Standard ); + bool found = doc->find( findcur, expr, cs, wo, forward ); + if ( found ) { + if ( para ) + *para = findcur.paragraph()->paragId(); + if ( index ) + *index = findcur.index(); + *cursor = findcur; + repaintChanged(); + ensureCursorVisible(); + } + drawCursor( TRUE ); + if (found) { + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); + } + return found; +} + +void TQTextEdit::blinkCursor() +{ + if ( !cursorVisible ) + return; + bool cv = cursorVisible; + blinkCursorVisible = !blinkCursorVisible; + drawCursor( blinkCursorVisible ); + cursorVisible = cv; +} + +/*! + Sets the cursor to position \a index in paragraph \a para. + + \sa getCursorPosition() +*/ + +void TQTextEdit::setCursorPosition( int para, int index ) +{ + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return; + + resetInputContext(); + if ( index > p->length() - 1 ) + index = p->length() - 1; + + drawCursor( FALSE ); + cursor->setParagraph( p ); + cursor->setIndex( index ); + ensureCursorVisible(); + drawCursor( TRUE ); + updateCurrentFormat(); + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); +} + +/*! + This function sets the \a *para and \a *index parameters to the + current cursor position. \a para and \a index must not be 0. + + \sa setCursorPosition() +*/ + +void TQTextEdit::getCursorPosition( int *para, int *index ) const +{ + if ( !para || !index ) + return; + *para = cursor->paragraph()->paragId(); + *index = cursor->index(); +} + +/*! + Sets a selection which starts at position \a indexFrom in + paragraph \a paraFrom and ends at position \a indexTo in paragraph + \a paraTo. + + Any existing selections which have a different id (\a selNum) are + left alone, but if an existing selection has the same id as \a + selNum it is removed and replaced by this selection. + + Uses the selection settings of selection \a selNum. If \a selNum + is 0, this is the default selection. + + The cursor is moved to the end of the selection if \a selNum is 0, + otherwise the cursor position remains unchanged. + + \sa getSelection() selectedText +*/ + +void TQTextEdit::setSelection( int paraFrom, int indexFrom, + int paraTo, int indexTo, int selNum ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if (d->optimMode) { + optimSetSelection(paraFrom, indexFrom, paraTo, indexTo); + repaintContents(FALSE); + return; + } +#endif + resetInputContext(); + if ( doc->hasSelection( selNum ) ) { + doc->removeSelection( selNum ); + repaintChanged(); + } + if ( selNum > doc->numSelections() - 1 ) + doc->addSelection( selNum ); + TQTextParagraph *p1 = doc->paragAt( paraFrom ); + if ( !p1 ) + return; + TQTextParagraph *p2 = doc->paragAt( paraTo ); + if ( !p2 ) + return; + + if ( indexFrom > p1->length() - 1 ) + indexFrom = p1->length() - 1; + if ( indexTo > p2->length() - 1 ) + indexTo = p2->length() - 1; + + drawCursor( FALSE ); + TQTextCursor c = *cursor; + TQTextCursor oldCursor = *cursor; + c.setParagraph( p1 ); + c.setIndex( indexFrom ); + cursor->setParagraph( p2 ); + cursor->setIndex( indexTo ); + doc->setSelectionStart( selNum, c ); + doc->setSelectionEnd( selNum, *cursor ); + repaintChanged(); + ensureCursorVisible(); + if ( selNum != TQTextDocument::Standard ) + *cursor = oldCursor; + drawCursor( TRUE ); +} + +/*! + If there is a selection, \a *paraFrom is set to the number of the + paragraph in which the selection begins and \a *paraTo is set to + the number of the paragraph in which the selection ends. (They + could be the same.) \a *indexFrom is set to the index at which the + selection begins within \a *paraFrom, and \a *indexTo is set to + the index at which the selection ends within \a *paraTo. + + If there is no selection, \a *paraFrom, \a *indexFrom, \a *paraTo + and \a *indexTo are all set to -1. + + If \a paraFrom, \a indexFrom, \a paraTo or \a indexTo is 0 this + function does nothing. + + The \a selNum is the number of the selection (multiple selections + are supported). It defaults to 0 (the default selection). + + \sa setSelection() selectedText +*/ + +void TQTextEdit::getSelection( int *paraFrom, int *indexFrom, + int *paraTo, int *indexTo, int selNum ) const +{ + if ( !paraFrom || !paraTo || !indexFrom || !indexTo ) + return; +#ifdef QT_TEXTEDIT_OPTIMIZATION + if (d->optimMode) { + *paraFrom = d->od->selStart.line; + *paraTo = d->od->selEnd.line; + *indexFrom = d->od->selStart.index; + *indexTo = d->od->selEnd.index; + return; + } +#endif + if ( !doc->hasSelection( selNum ) ) { + *paraFrom = -1; + *indexFrom = -1; + *paraTo = -1; + *indexTo = -1; + return; + } + + doc->selectionStart( selNum, *paraFrom, *indexFrom ); + doc->selectionEnd( selNum, *paraTo, *indexTo ); +} + +/*! + \property TQTextEdit::textFormat + \brief the text format: rich text, plain text, log text or auto text. + + The text format is one of the following: + \list + \i PlainText - all characters, except newlines, are displayed + verbatim, including spaces. Whenever a newline appears in the text + the text edit inserts a hard line break and begins a new + paragraph. + \i RichText - rich text rendering. The available styles are + defined in the default stylesheet TQStyleSheet::defaultSheet(). + \i LogText - optimized mode for very large texts. Supports a very + limited set of formatting tags (color, bold, underline and italic + settings). + \i AutoText - this is the default. The text edit autodetects which + rendering style is best, \c PlainText or \c RichText. This is done + by using the TQStyleSheet::mightBeRichText() function. + \endlist +*/ + +void TQTextEdit::setTextFormat( TextFormat format ) +{ + doc->setTextFormat( format ); +#ifdef QT_TEXTEDIT_OPTIMIZATION + checkOptimMode(); +#endif +} + +TQt::TextFormat TQTextEdit::textFormat() const +{ + return doc->textFormat(); +} + +/*! + Returns the number of paragraphs in the text; an empty textedit is always + considered to have one paragraph, so 1 is returned in this case. +*/ + +int TQTextEdit::paragraphs() const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + return d->od->numLines; + } +#endif + return doc->lastParagraph()->paragId() + 1; +} + +/*! + Returns the number of lines in paragraph \a para, or -1 if there + is no paragraph with index \a para. +*/ + +int TQTextEdit::linesOfParagraph( int para ) const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + if ( d->od->numLines >= para ) + return 1; + else + return -1; + } +#endif + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return -1; + return p->lines(); +} + +/*! + Returns the length of the paragraph \a para (i.e. the number of + characters), or -1 if there is no paragraph with index \a para. + + This function ignores newlines. +*/ + +int TQTextEdit::paragraphLength( int para ) const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + if ( d->od->numLines >= para ) { + if ( d->od->lines[ LOGOFFSET(para) ].isEmpty() ) // CR + return 1; + else + return d->od->lines[ LOGOFFSET(para) ].length(); + } + return -1; + } +#endif + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return -1; + return p->length() - 1; +} + +/*! + Returns the number of lines in the text edit; this could be 0. + + \warning This function may be slow. Lines change all the time + during word wrapping, so this function has to iterate over all the + paragraphs and get the number of lines from each one individually. +*/ + +int TQTextEdit::lines() const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + return d->od->numLines; + } +#endif + TQTextParagraph *p = doc->firstParagraph(); + int l = 0; + while ( p ) { + l += p->lines(); + p = p->next(); + } + + return l; +} + +/*! + Returns the line number of the line in paragraph \a para in which + the character at position \a index appears. The \a index position is + relative to the beginning of the paragraph. If there is no such + paragraph or no such character at the \a index position (e.g. the + index is out of range) -1 is returned. +*/ + +int TQTextEdit::lineOfChar( int para, int index ) +{ + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return -1; + + int idx, line; + TQTextStringChar *c = p->lineStartOfChar( index, &idx, &line ); + if ( !c ) + return -1; + + return line; +} + +void TQTextEdit::setModified( bool m ) +{ + bool oldModified = modified; + modified = m; + if ( modified && doc->oTextValid ) + doc->invalidateOriginalText(); + if ( oldModified != modified ) + emit modificationChanged( modified ); +} + +/*! + \property TQTextEdit::modified + \brief whether the document has been modified by the user +*/ + +bool TQTextEdit::isModified() const +{ + return modified; +} + +void TQTextEdit::setModified() +{ + if ( !isModified() ) + setModified( TRUE ); +} + +/*! + Returns TRUE if the current format is italic; otherwise returns FALSE. + + \sa setItalic() +*/ + +bool TQTextEdit::italic() const +{ + return currentFormat->font().italic(); +} + +/*! + Returns TRUE if the current format is bold; otherwise returns FALSE. + + \sa setBold() +*/ + +bool TQTextEdit::bold() const +{ + return currentFormat->font().bold(); +} + +/*! + Returns TRUE if the current format is underlined; otherwise returns + FALSE. + + \sa setUnderline() +*/ + +bool TQTextEdit::underline() const +{ + return currentFormat->font().underline(); +} + +/*! + Returns the font family of the current format. + + \sa setFamily() setCurrentFont() setPointSize() +*/ + +TQString TQTextEdit::family() const +{ + return currentFormat->font().family(); +} + +/*! + Returns the point size of the font of the current format. + + \sa setFamily() setCurrentFont() setPointSize() +*/ + +int TQTextEdit::pointSize() const +{ + return currentFormat->font().pointSize(); +} + +/*! + Returns the color of the current format. + + \sa setColor() setPaper() +*/ + +TQColor TQTextEdit::color() const +{ + return currentFormat->color(); +} + +/*! + \obsolete + + Returns TQScrollView::font() + + \warning In previous versions this function returned the font of + the current format. This lead to confusion. Please use + currentFont() instead. +*/ + +TQFont TQTextEdit::font() const +{ + return TQScrollView::font(); +} + +/*! + Returns the font of the current format. + + \sa setCurrentFont() setFamily() setPointSize() +*/ + +TQFont TQTextEdit::currentFont() const +{ + return currentFormat->font(); +} + + +/*! + Returns the alignment of the current paragraph. + + \sa setAlignment() +*/ + +int TQTextEdit::alignment() const +{ + return currentAlignment; +} + +void TQTextEdit::startDrag() +{ +#ifndef TQT_NO_DRAGANDDROP + mousePressed = FALSE; + inDoubleClick = FALSE; + TQDragObject *drag = dragObject( viewport() ); + if ( !drag ) + return; + if ( isReadOnly() ) { + drag->dragCopy(); + } else { + if ( drag->drag() && TQDragObject::target() != this && TQDragObject::target() != viewport() ) + removeSelectedText(); + } +#endif +} + +/*! + If \a select is TRUE (the default), all the text is selected as + selection 0. If \a select is FALSE any selected text is + unselected, i.e. the default selection (selection 0) is cleared. + + \sa selectedText +*/ + +void TQTextEdit::selectAll( bool select ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + if ( select ) + optimSelectAll(); + else + optimRemoveSelection(); + return; + } +#endif + if ( !select ) + doc->removeSelection( TQTextDocument::Standard ); + else + doc->selectAll( TQTextDocument::Standard ); + repaintChanged(); + emit copyAvailable( doc->hasSelection( TQTextDocument::Standard ) ); + emit selectionChanged(); +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif +} + +void TQTextEdit::UndoRedoInfo::clear() +{ + if ( valid() ) { + if ( type == Insert || type == Return ) + doc->addCommand( new TQTextInsertCommand( doc, id, index, d->text.rawData(), styleInformation ) ); + else if ( type == Format ) + doc->addCommand( new TQTextFormatCommand( doc, id, index, eid, eindex, d->text.rawData(), format, flags ) ); + else if ( type == Style ) + doc->addCommand( new TQTextStyleCommand( doc, id, eid, styleInformation ) ); + else if ( type != Invalid ) { + doc->addCommand( new TQTextDeleteCommand( doc, id, index, d->text.rawData(), styleInformation ) ); + } + } + type = Invalid; + d->text = TQString::null; + id = -1; + index = -1; + styleInformation = TQByteArray(); +} + + +/*! + If there is some selected text (in selection 0) it is deleted. If + there is no selected text (in selection 0) the character to the + right of the text cursor is deleted. + + \sa removeSelectedText() cut() +*/ + +void TQTextEdit::del() +{ + if ( doc->hasSelection( TQTextDocument::Standard ) ) { + removeSelectedText(); + return; + } + + doKeyboardAction( ActionDelete ); +} + + +TQTextEdit::UndoRedoInfo::UndoRedoInfo( TQTextDocument *dc ) + : type( Invalid ), doc( dc ) +{ + d = new TQUndoRedoInfoPrivate; + d->text = TQString::null; + id = -1; + index = -1; +} + +TQTextEdit::UndoRedoInfo::~UndoRedoInfo() +{ + delete d; +} + +bool TQTextEdit::UndoRedoInfo::valid() const +{ + return id >= 0 && type != Invalid; +} + +/*! + \internal + + Resets the current format to the default format. +*/ + +void TQTextEdit::resetFormat() +{ + setAlignment( TQt::AlignAuto ); + setParagType( TQStyleSheetItem::DisplayBlock, TQStyleSheetItem::ListDisc ); + setFormat( doc->formatCollection()->defaultFormat(), TQTextFormat::Format ); +} + +/*! + Returns the TQStyleSheet which is being used by this text edit. + + \sa setStyleSheet() +*/ + +TQStyleSheet* TQTextEdit::styleSheet() const +{ + return doc->styleSheet(); +} + +/*! + Sets the stylesheet to use with this text edit to \a styleSheet. + Changes will only take effect for new text added with setText() or + append(). + + \sa styleSheet() +*/ + +void TQTextEdit::setStyleSheet( TQStyleSheet* styleSheet ) +{ + doc->setStyleSheet( styleSheet ); +} + +/*! + \property TQTextEdit::paper + \brief the background (paper) brush. + + The brush that is currently used to draw the background of the + text edit. The initial setting is an empty brush. +*/ + +void TQTextEdit::setPaper( const TQBrush& pap ) +{ + doc->setPaper( new TQBrush( pap ) ); + + if ( pap.pixmap() ) { + viewport()->setBackgroundPixmap( *pap.pixmap() ); + } else { + setPaletteBackgroundColor( pap.color() ); + viewport()->setPaletteBackgroundColor( pap.color() ); + } + +#ifdef QT_TEXTEDIT_OPTIMIZATION + // force a repaint of the entire viewport - using updateContents() + // would clip the coords to the content size + if (d->optimMode) + repaintContents(contentsX(), contentsY(), viewport()->width(), viewport()->height()); + else +#endif + updateContents(); +} + +TQBrush TQTextEdit::paper() const +{ + if ( doc->paper() ) + return *doc->paper(); + return TQBrush( colorGroup().base() ); +} + +/*! + \property TQTextEdit::linkUnderline + \brief whether hypertext links will be underlined + + If TRUE (the default) hypertext links will be displayed + underlined. If FALSE links will not be displayed underlined. +*/ + +void TQTextEdit::setLinkUnderline( bool b ) +{ + if ( doc->underlineLinks() == b ) + return; + doc->setUnderlineLinks( b ); + repaintChanged(); +} + +bool TQTextEdit::linkUnderline() const +{ + return doc->underlineLinks(); +} + +/*! + Sets the text edit's mimesource factory to \a factory. See + TQMimeSourceFactory for further details. + + \sa mimeSourceFactory() + */ + +#ifndef TQT_NO_MIME +void TQTextEdit::setMimeSourceFactory( TQMimeSourceFactory* factory ) +{ + doc->setMimeSourceFactory( factory ); +} + +/*! + Returns the TQMimeSourceFactory which is being used by this text + edit. + + \sa setMimeSourceFactory() +*/ + +TQMimeSourceFactory* TQTextEdit::mimeSourceFactory() const +{ + return doc->mimeSourceFactory(); +} +#endif + +/*! + Returns how many pixels high the text edit needs to be to display + all the text if the text edit is \a w pixels wide. +*/ + +int TQTextEdit::heightForWidth( int w ) const +{ + int oldw = doc->width(); + doc->doLayout( 0, w ); + int h = doc->height(); + doc->setWidth( oldw ); + doc->invalidate(); + ( (TQTextEdit*)this )->formatMore(); + return h; +} + +/*! + Appends a new paragraph with \a text to the end of the text edit. Note that + the undo/redo history is cleared by this function, and no undo + history is kept for appends which makes them faster than + insert()s. If you want to append text which is added to the + undo/redo history as well, use insertParagraph(). +*/ + +void TQTextEdit::append( const TQString &text ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimAppend( text ); + return; + } +#endif + // flush and clear the undo/redo stack if necessary + undoRedoInfo.clear(); + doc->commands()->clear(); + + doc->removeSelection( TQTextDocument::Standard ); + TextFormat f = doc->textFormat(); + if ( f == AutoText ) { + if ( TQStyleSheet::mightBeRichText( text ) ) + f = RichText; + else + f = PlainText; + } + + drawCursor( FALSE ); + TQTextCursor oldc( *cursor ); + ensureFormatted( doc->lastParagraph() ); + bool atBottom = contentsY() >= contentsHeight() - visibleHeight(); + cursor->gotoEnd(); + if ( cursor->index() > 0 ) + cursor->splitAndInsertEmptyParagraph(); + TQTextCursor oldCursor2 = *cursor; + + if ( f == TQt::PlainText ) { + cursor->insert( text, TRUE ); + if ( doc->useFormatCollection() && !doc->preProcessor() && + currentFormat != cursor->paragraph()->at( cursor->index() )->format() ) { + doc->setSelectionStart( TQTextDocument::Temp, oldCursor2 ); + doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); + doc->setFormat( TQTextDocument::Temp, currentFormat, TQTextFormat::Format ); + doc->removeSelection( TQTextDocument::Temp ); + } + } else { + cursor->paragraph()->setListItem( FALSE ); + cursor->paragraph()->setListDepth( 0 ); + if ( cursor->paragraph()->prev() ) + cursor->paragraph()->prev()->invalidate(0); // vertical margins might have to change + doc->setRichTextInternal( text ); + } + formatMore(); + repaintChanged(); + if ( atBottom ) + scrollToBottom(); + *cursor = oldc; + if ( !isReadOnly() ) + cursorVisible = TRUE; + setModified(); + emit textChanged(); +} + +/*! + \property TQTextEdit::hasSelectedText + \brief whether some text is selected in selection 0 +*/ + +bool TQTextEdit::hasSelectedText() const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return optimHasSelection(); + else +#endif + return doc->hasSelection( TQTextDocument::Standard ); +} + +/*! + \property TQTextEdit::selectedText + \brief The selected text (from selection 0) or an empty string if + there is no currently selected text (in selection 0). + + The text is always returned as \c PlainText if the textFormat() is + \c PlainText or \c AutoText, otherwise it is returned as HTML. + + \sa hasSelectedText +*/ + +TQString TQTextEdit::selectedText() const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return optimSelectedText(); + else +#endif + return doc->selectedText( TQTextDocument::Standard, textFormat() == RichText ); +} + +bool TQTextEdit::handleReadOnlyKeyEvent( TQKeyEvent *e ) +{ + switch( e->key() ) { + case Key_Down: + setContentsPos( contentsX(), contentsY() + 10 ); + break; + case Key_Up: + setContentsPos( contentsX(), contentsY() - 10 ); + break; + case Key_Left: + setContentsPos( contentsX() - 10, contentsY() ); + break; + case Key_Right: + setContentsPos( contentsX() + 10, contentsY() ); + break; + case Key_PageUp: + setContentsPos( contentsX(), contentsY() - visibleHeight() ); + break; + case Key_PageDown: + setContentsPos( contentsX(), contentsY() + visibleHeight() ); + break; + case Key_Home: + setContentsPos( contentsX(), 0 ); + break; + case Key_End: + setContentsPos( contentsX(), contentsHeight() - visibleHeight() ); + break; + case Key_F16: // Copy key on Sun keyboards + copy(); + break; +#ifndef TQT_NO_NETWORKPROTOCOL + case Key_Return: + case Key_Enter: + case Key_Space: { + if (!doc->focusIndicator.href.isEmpty() + || !doc->focusIndicator.name.isEmpty()) { + if (!doc->focusIndicator.href.isEmpty()) { + TQUrl u( doc->context(), doc->focusIndicator.href, TRUE ); + emitLinkClicked( u.toString( FALSE, FALSE ) ); + } + if (!doc->focusIndicator.name.isEmpty()) { + if (::tqt_cast<TQTextBrowser*>(this)) { // change for 4.0 + TQConnectionList *clist = receivers( + "anchorClicked(const TQString&,const TQString&)"); + if (!signalsBlocked() && clist) { + TQUObject o[3]; + static_QUType_TQString.set(o+1, + doc->focusIndicator.name); + static_QUType_TQString.set(o+2, + doc->focusIndicator.href); + activate_signal( clist, o); + } + } + } +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + } + } break; +#endif + default: + if ( e->state() & ControlButton ) { + switch ( e->key() ) { + case Key_C: case Key_F16: // Copy key on Sun keyboards + copy(); + break; +#ifdef TQ_WS_WIN + case Key_Insert: + copy(); + break; + case Key_A: + selectAll(); + break; +#endif + } + + } + return FALSE; + } + return TRUE; +} + +/*! + Returns the context of the text edit. The context is a path which + the text edit's TQMimeSourceFactory uses to resolve the locations + of files and images. + + \sa text +*/ + +TQString TQTextEdit::context() const +{ + return doc->context(); +} + +/*! + \property TQTextEdit::documentTitle + \brief the title of the document parsed from the text. + + For \c PlainText the title will be an empty string. For \c + RichText the title will be the text between the \c{<title>} tags, + if present, otherwise an empty string. +*/ + +TQString TQTextEdit::documentTitle() const +{ + return doc->attributes()[ "title" ]; +} + +void TQTextEdit::makeParagVisible( TQTextParagraph *p ) +{ + setContentsPos( contentsX(), TQMIN( p->rect().y(), contentsHeight() - visibleHeight() ) ); +} + +/*! + Scrolls the text edit to make the text at the anchor called \a + name visible, if it can be found in the document. If the anchor + isn't found no scrolling will occur. An anchor is defined using + the HTML anchor tag, e.g. \c{<a name="target">}. +*/ + +void TQTextEdit::scrollToAnchor( const TQString& name ) +{ + if ( !isVisible() ) { + d->scrollToAnchor = name; + return; + } + if ( name.isEmpty() ) + return; + sync(); + TQTextCursor cursor( doc ); + TQTextParagraph* last = doc->lastParagraph(); + for (;;) { + TQTextStringChar* c = cursor.paragraph()->at( cursor.index() ); + if( c->isAnchor() ) { + TQString a = c->anchorName(); + if ( a == name || + (a.contains( '#' ) && TQStringList::split( '#', a ).contains( name ) ) ) { + setContentsPos( contentsX(), TQMIN( cursor.paragraph()->rect().top() + cursor.totalOffsetY(), contentsHeight() - visibleHeight() ) ); + break; + } + } + if ( cursor.paragraph() == last && cursor.atParagEnd() ) + break; + cursor.gotoNextLetter(); + } +} + +/*! + \overload + + If there is an anchor at position \a pos (in contents + coordinates), its \c href is returned, otherwise TQString::null is + returned. +*/ + +TQString TQTextEdit::anchorAt( const TQPoint& pos ) +{ + return anchorAt(pos, AnchorHref); +} + +/*! + If there is an anchor at position \a pos (in contents + coordinates), the text for attribute \a attr is returned, + otherwise TQString::null is returned. +*/ + +TQString TQTextEdit::anchorAt( const TQPoint& pos, AnchorAttribute attr ) +{ + TQTextCursor c( doc ); + placeCursor( pos, &c ); + switch(attr) { + case AnchorName: + return c.paragraph()->at( c.index() )->anchorName(); + case AnchorHref: + return c.paragraph()->at( c.index() )->anchorHref(); + } + // incase the compiler is really dumb about determining if a function + // returns something :) + return TQString::null; +} + +void TQTextEdit::documentWidthChanged( int w ) +{ + resizeContents( TQMAX( visibleWidth(), w), contentsHeight() ); +} + +/*! \internal + + This function does nothing +*/ + +void TQTextEdit::updateStyles() +{ +} + +void TQTextEdit::setDocument( TQTextDocument *dc ) +{ + if ( dc == 0 ) { + tqWarning( "Q3TextEdit::setDocument() called with null Q3TextDocument pointer" ); + return; + } + if ( dc == doc ) + return; + resetInputContext(); + doc = dc; + delete cursor; + cursor = new TQTextCursor( doc ); + clearUndoRedo(); + undoRedoInfo.doc = doc; + lastFormatted = 0; +} + +#ifndef TQT_NO_CLIPBOARD + +/*! + Pastes the text with format \a subtype from the clipboard into the + text edit at the current cursor position. The \a subtype can be + "plain" or "html". + + If there is no text with format \a subtype in the clipboard + nothing happens. + + \sa paste() cut() TQTextEdit::copy() +*/ + +void TQTextEdit::pasteSubType( const TQCString &subtype ) +{ +#ifndef TQT_NO_MIMECLIPBOARD + TQMimeSource *m = TQApplication::clipboard()->data( d->clipboard_mode ); + pasteSubType( subtype, m ); +#endif +} + +/*! \internal */ + +void TQTextEdit::pasteSubType( const TQCString& subtype, TQMimeSource *m ) +{ +#ifndef TQT_NO_MIME + TQCString st = subtype; + if ( subtype != "x-qrichtext" ) + st.prepend( "text/" ); + else + st.prepend( "application/" ); + if ( !m ) + return; + if ( doc->hasSelection( TQTextDocument::Standard ) ) + removeSelectedText(); + if ( !TQRichTextDrag::canDecode( m ) ) + return; + TQString t; + if ( !TQRichTextDrag::decode( m, t, st.data(), subtype ) ) + return; + if ( st == "application/x-qrichtext" ) { + int start; + if ( (start = t.find( "<!--StartFragment-->" )) != -1 ) { + start += 20; + int end = t.find( "<!--EndFragment-->" ); + TQTextCursor oldC = *cursor; + + // during the setRichTextInternal() call the cursors + // paragraph might get joined with the provious one, so + // the cursors one would get deleted and oldC.paragraph() + // would be a dnagling pointer. To avoid that try to go + // one letter back and later go one forward again. + oldC.gotoPreviousLetter(); + bool couldGoBack = oldC != *cursor; + // first para might get deleted, so remember to reset it + bool wasAtFirst = oldC.paragraph() == doc->firstParagraph(); + + if ( start < end ) + t = t.mid( start, end - start ); + else + t = t.mid( start ); + lastFormatted = cursor->paragraph(); + if ( lastFormatted->prev() ) + lastFormatted = lastFormatted->prev(); + doc->setRichTextInternal( t, cursor ); + + // the first para might have been deleted in + // setRichTextInternal(). To be sure, reset it if + // necessary. + if ( wasAtFirst ) { + int index = oldC.index(); + oldC.setParagraph( doc->firstParagraph() ); + oldC.setIndex( index ); + } + + // if we went back one letter before (see last comment), + // go one forward to point to the right position + if ( couldGoBack ) + oldC.gotoNextLetter(); + + if ( undoEnabled && !isReadOnly() ) { + doc->setSelectionStart( TQTextDocument::Temp, oldC ); + doc->setSelectionEnd( TQTextDocument::Temp, *cursor ); + + checkUndoRedoInfo( UndoRedoInfo::Insert ); + if ( !undoRedoInfo.valid() ) { + undoRedoInfo.id = oldC.paragraph()->paragId(); + undoRedoInfo.index = oldC.index(); + undoRedoInfo.d->text = TQString::null; + } + int oldLen = undoRedoInfo.d->text.length(); + if ( !doc->preProcessor() ) { + TQString txt = doc->selectedText( TQTextDocument::Temp ); + undoRedoInfo.d->text += txt; + for ( int i = 0; i < (int)txt.length(); ++i ) { + if ( txt[ i ] != '\n' && oldC.paragraph()->at( oldC.index() )->format() ) { + oldC.paragraph()->at( oldC.index() )->format()->addRef(); + undoRedoInfo.d->text. + setFormat( oldLen + i, oldC.paragraph()->at( oldC.index() )->format(), TRUE ); + } + oldC.gotoNextLetter(); + } + } + undoRedoInfo.clear(); + removeSelection( TQTextDocument::Temp ); + } + + formatMore(); + setModified(); + emit textChanged(); + repaintChanged(); + ensureCursorVisible(); + return; + } + } else { +#if defined(Q_OS_WIN32) + // Need to convert CRLF to LF + t.replace( "\r\n", "\n" ); +#elif defined(Q_OS_MAC) + //need to convert CR to LF + t.replace( '\r', '\n' ); +#endif + TQChar *uc = (TQChar *)t.unicode(); + for ( int i=0; (uint) i<t.length(); i++ ) { + if ( uc[ i ] < ' ' && uc[ i ] != '\n' && uc[ i ] != '\t' ) + uc[ i ] = ' '; + } + if ( !t.isEmpty() ) + insert( t, FALSE, TRUE ); + } +#endif //TQT_NO_MIME +} + +#ifndef TQT_NO_MIMECLIPBOARD +/*! + Prompts the user to choose a type from a list of text types + available, then copies text from the clipboard (if there is any) + into the text edit at the current text cursor position. Any + selected text (in selection 0) is first deleted. +*/ +void TQTextEdit::pasteSpecial( const TQPoint& pt ) +{ + TQCString st = pickSpecial( TQApplication::clipboard()->data( d->clipboard_mode ), + TRUE, pt ); + if ( !st.isEmpty() ) + pasteSubType( st ); +} +#endif +#ifndef TQT_NO_MIME +TQCString TQTextEdit::pickSpecial( TQMimeSource* ms, bool always_ask, const TQPoint& pt ) +{ + if ( ms ) { +#ifndef TQT_NO_POPUPMENU + TQPopupMenu popup( this, "qt_pickspecial_menu" ); + TQString fmt; + int n = 0; + TQDict<void> done; + for (int i = 0; !( fmt = ms->format( i ) ).isNull(); i++) { + int semi = fmt.find( ";" ); + if ( semi >= 0 ) + fmt = fmt.left( semi ); + if ( fmt.left( 5 ) == "text/" ) { + fmt = fmt.mid( 5 ); + if ( !done.find( fmt ) ) { + done.insert( fmt,(void*)1 ); + popup.insertItem( fmt, i ); + n++; + } + } + } + if ( n ) { + int i = n ==1 && !always_ask ? popup.idAt( 0 ) : popup.exec( pt ); + if ( i >= 0 ) + return popup.text(i).latin1(); + } +#else + TQString fmt; + for (int i = 0; !( fmt = ms->format( i ) ).isNull(); i++) { + int semi = fmt.find( ";" ); + if ( semi >= 0 ) + fmt = fmt.left( semi ); + if ( fmt.left( 5 ) == "text/" ) { + fmt = fmt.mid( 5 ); + return fmt.latin1(); + } + } +#endif + } + return TQCString(); +} +#endif // TQT_NO_MIME +#endif // TQT_NO_CLIPBOARD + +/*! + \enum TQTextEdit::WordWrap + + This enum defines the TQTextEdit's word wrap modes. + + \value NoWrap Do not wrap the text. + + \value WidgetWidth Wrap the text at the current width of the + widget (this is the default). Wrapping is at whitespace by + default; this can be changed with setWrapPolicy(). + + \value FixedPixelWidth Wrap the text at a fixed number of pixels + from the widget's left side. The number of pixels is set with + wrapColumnOrWidth(). + + \value FixedColumnWidth Wrap the text at a fixed number of + character columns from the widget's left side. The number of + characters is set with wrapColumnOrWidth(). This is useful if you + need formatted text that can also be displayed gracefully on + devices with monospaced fonts, for example a standard VT100 + terminal, where you might set wrapColumnOrWidth() to 80. + + \sa setWordWrap() wordWrap() +*/ + +/*! + \property TQTextEdit::wordWrap + \brief the word wrap mode + + The default mode is \c WidgetWidth which causes words to be + wrapped at the right edge of the text edit. Wrapping occurs at + whitespace, keeping whole words intact. If you want wrapping to + occur within words use setWrapPolicy(). If you set a wrap mode of + \c FixedPixelWidth or \c FixedColumnWidth you should also call + setWrapColumnOrWidth() with the width you want. + + \sa WordWrap, wrapColumnOrWidth, wrapPolicy, +*/ + +void TQTextEdit::setWordWrap( WordWrap mode ) +{ + if ( wrapMode == mode ) + return; + wrapMode = mode; + switch ( mode ) { + case NoWrap: + document()->formatter()->setWrapEnabled( FALSE ); + document()->formatter()->setWrapAtColumn( -1 ); + doc->setWidth( visibleWidth() ); + doc->setMinimumWidth( -1 ); + doc->invalidate(); + updateContents(); + lastFormatted = doc->firstParagraph(); + interval = 0; + formatMore(); + break; + case WidgetWidth: + document()->formatter()->setWrapEnabled( TRUE ); + document()->formatter()->setWrapAtColumn( -1 ); + doResize(); + break; + case FixedPixelWidth: + document()->formatter()->setWrapEnabled( TRUE ); + document()->formatter()->setWrapAtColumn( -1 ); + if ( wrapWidth < 0 ) + wrapWidth = 200; + setWrapColumnOrWidth( wrapWidth ); + break; + case FixedColumnWidth: + if ( wrapWidth < 0 ) + wrapWidth = 80; + document()->formatter()->setWrapEnabled( TRUE ); + document()->formatter()->setWrapAtColumn( wrapWidth ); + setWrapColumnOrWidth( wrapWidth ); + break; + } +#ifdef QT_TEXTEDIT_OPTIMIZATION + checkOptimMode(); +#endif +} + +TQTextEdit::WordWrap TQTextEdit::wordWrap() const +{ + return wrapMode; +} + +/*! + \property TQTextEdit::wrapColumnOrWidth + \brief the position (in pixels or columns depending on the wrap mode) where text will be wrapped + + If the wrap mode is \c FixedPixelWidth, the value is the number of + pixels from the left edge of the text edit at which text should be + wrapped. If the wrap mode is \c FixedColumnWidth, the value is the + column number (in character columns) from the left edge of the + text edit at which text should be wrapped. + + \sa wordWrap +*/ +void TQTextEdit::setWrapColumnOrWidth( int value ) +{ + wrapWidth = value; + if ( wrapMode == FixedColumnWidth ) { + document()->formatter()->setWrapAtColumn( wrapWidth ); + resizeContents( 0, 0 ); + doc->setWidth( visibleWidth() ); + doc->setMinimumWidth( -1 ); + } else if (wrapMode == FixedPixelWidth ) { + document()->formatter()->setWrapAtColumn( -1 ); + resizeContents( wrapWidth, 0 ); + doc->setWidth( wrapWidth ); + doc->setMinimumWidth( wrapWidth ); + } else { + return; + } + doc->invalidate(); + updateContents(); + lastFormatted = doc->firstParagraph(); + interval = 0; + formatMore(); +} + +int TQTextEdit::wrapColumnOrWidth() const +{ + if ( wrapMode == WidgetWidth ) + return visibleWidth(); + return wrapWidth; +} + + +/*! + \enum TQTextEdit::WrapPolicy + + This enum defines where text can be wrapped in word wrap mode. + + \value AtWhiteSpace Don't use this deprecated value (it is a + synonym for \c AtWordBoundary which you should use instead). + \value Anywhere Break anywhere, including within words. + \value AtWordBoundary Break lines at word boundaries, e.g. spaces or + newlines + \value AtWordOrDocumentBoundary Break lines at whitespace, e.g. + spaces or newlines if possible. Break it anywhere otherwise. + + \sa setWrapPolicy() +*/ + +/*! + \property TQTextEdit::wrapPolicy + \brief the word wrap policy, at whitespace or anywhere + + Defines where text can be wrapped when word wrap mode is not \c + NoWrap. The choices are \c AtWordBoundary (the default), \c + Anywhere and \c AtWordOrDocumentBoundary + + \sa wordWrap +*/ + +void TQTextEdit::setWrapPolicy( WrapPolicy policy ) +{ + if ( wPolicy == policy ) + return; + wPolicy = policy; + TQTextFormatter *formatter; + if ( policy == AtWordBoundary || policy == AtWordOrDocumentBoundary ) { + formatter = new TQTextFormatterBreakWords; + formatter->setAllowBreakInWords( policy == AtWordOrDocumentBoundary ); + } else { + formatter = new TQTextFormatterBreakInWords; + } + formatter->setWrapAtColumn( document()->formatter()->wrapAtColumn() ); + formatter->setWrapEnabled( document()->formatter()->isWrapEnabled( 0 ) ); + document()->setFormatter( formatter ); + doc->invalidate(); + updateContents(); + lastFormatted = doc->firstParagraph(); + interval = 0; + formatMore(); +} + +TQTextEdit::WrapPolicy TQTextEdit::wrapPolicy() const +{ + return wPolicy; +} + +/*! + Deletes all the text in the text edit. + + \sa cut() removeSelectedText() setText() +*/ + +void TQTextEdit::clear() +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + optimSetText(""); + } else +#endif + { + // make clear undoable + doc->selectAll( TQTextDocument::Temp ); + removeSelectedText( TQTextDocument::Temp ); + setContentsPos( 0, 0 ); + if ( cursor->isValid() ) + cursor->restoreState(); + doc->clear( TRUE ); + delete cursor; + cursor = new TQTextCursor( doc ); + lastFormatted = 0; + } + updateContents(); + + emit cursorPositionChanged( cursor ); + emit cursorPositionChanged( cursor->paragraph()->paragId(), cursor->index() ); +} + +int TQTextEdit::undoDepth() const +{ + return document()->undoDepth(); +} + +/*! + \property TQTextEdit::length + \brief the number of characters in the text +*/ + +int TQTextEdit::length() const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) + return d->od->len; + else +#endif + return document()->length(); +} + +/*! + \property TQTextEdit::tabStopWidth + \brief the tab stop width in pixels +*/ + +int TQTextEdit::tabStopWidth() const +{ + return document()->tabStopWidth(); +} + +void TQTextEdit::setUndoDepth( int d ) +{ + document()->setUndoDepth( d ); +} + +void TQTextEdit::setTabStopWidth( int ts ) +{ + document()->setTabStops( ts ); + doc->invalidate(); + lastFormatted = doc->firstParagraph(); + interval = 0; + formatMore(); + updateContents(); +} + +/*! + \reimp +*/ + +TQSize TQTextEdit::sizeHint() const +{ + // cf. TQScrollView::sizeHint() + constPolish(); + int f = 2 * frameWidth(); + int h = fontMetrics().height(); + TQSize sz( f, f ); + return sz.expandedTo( TQSize(12 * h, 8 * h) ); +} + +void TQTextEdit::clearUndoRedo() +{ + if ( !undoEnabled ) + return; + undoRedoInfo.clear(); + emit undoAvailable( doc->commands()->isUndoAvailable() ); + emit redoAvailable( doc->commands()->isRedoAvailable() ); +} + +/*! \internal + \warning In TQt 3.1 we will provide a cleaer API for the + functionality which is provided by this function and in TQt 4.0 this + function will go away. + + This function gets the format of the character at position \a + index in paragraph \a para. Sets \a font to the character's font, \a + color to the character's color and \a verticalAlignment to the + character's vertical alignment. + + Returns FALSE if \a para or \a index is out of range otherwise + returns TRUE. +*/ + +bool TQTextEdit::getFormat( int para, int index, TQFont *font, TQColor *color, VerticalAlignment *verticalAlignment ) +{ + if ( !font || !color ) + return FALSE; + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return FALSE; + if ( index < 0 || index >= p->length() ) + return FALSE; + *font = p->at( index )->format()->font(); + *color = p->at( index )->format()->color(); + *verticalAlignment = (VerticalAlignment)p->at( index )->format()->vAlign(); + return TRUE; +} + +/*! \internal + \warning In TQt 3.1 we will provide a cleaer API for the + functionality which is provided by this function and in TQt 4.0 this + function will go away. + + This function gets the format of the paragraph \a para. Sets \a + font to the paragraphs's font, \a color to the paragraph's color, \a + verticalAlignment to the paragraph's vertical alignment, \a + alignment to the paragraph's alignment, \a displayMode to the + paragraph's display mode, \a listStyle to the paragraph's list style + (if the display mode is TQStyleSheetItem::DisplayListItem) and \a + listDepth to the depth of the list (if the display mode is + TQStyleSheetItem::DisplayListItem). + + Returns FALSE if \a para is out of range otherwise returns TRUE. +*/ + +bool TQTextEdit::getParagraphFormat( int para, TQFont *font, TQColor *color, + VerticalAlignment *verticalAlignment, int *alignment, + TQStyleSheetItem::DisplayMode *displayMode, + TQStyleSheetItem::ListStyle *listStyle, + int *listDepth ) +{ + if ( !font || !color || !alignment || !displayMode || !listStyle ) + return FALSE; + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return FALSE; + *font = p->at(0)->format()->font(); + *color = p->at(0)->format()->color(); + *verticalAlignment = (VerticalAlignment)p->at(0)->format()->vAlign(); + *alignment = p->alignment(); + *displayMode = p->isListItem() ? TQStyleSheetItem::DisplayListItem : TQStyleSheetItem::DisplayBlock; + *listStyle = p->listStyle(); + *listDepth = p->listDepth(); + return TRUE; +} + + + +/*! + This function is called to create a right mouse button popup menu + at the document position \a pos. If you want to create a custom + popup menu, reimplement this function and return the created popup + menu. Ownership of the popup menu is transferred to the caller. + + \warning The TQPopupMenu ID values 0-7 are reserved, and they map to the + standard operations. When inserting items into your custom popup menu, be + sure to specify ID values larger than 7. +*/ + +TQPopupMenu *TQTextEdit::createPopupMenu( const TQPoint& pos ) +{ + Q_UNUSED( pos ) +#ifndef TQT_NO_POPUPMENU + TQPopupMenu *popup = new TQPopupMenu( this, "qt_edit_menu" ); + if ( !isReadOnly() ) { + d->id[ IdUndo ] = popup->insertItem( tr( "&Undo" ) + ACCEL_KEY( Z ) ); + d->id[ IdRedo ] = popup->insertItem( tr( "&Redo" ) + ACCEL_KEY( Y ) ); + popup->insertSeparator(); + } +#ifndef TQT_NO_CLIPBOARD + if ( !isReadOnly() ) + d->id[ IdCut ] = popup->insertItem( tr( "Cu&t" ) + ACCEL_KEY( X ) ); + d->id[ IdCopy ] = popup->insertItem( tr( "&Copy" ) + ACCEL_KEY( C ) ); + if ( !isReadOnly() ) + d->id[ IdPaste ] = popup->insertItem( tr( "&Paste" ) + ACCEL_KEY( V ) ); +#endif + if ( !isReadOnly() ) { + d->id[ IdClear ] = popup->insertItem( tr( "Clear" ) ); + popup->insertSeparator(); + } +#if defined(TQ_WS_X11) + d->id[ IdSelectAll ] = popup->insertItem( tr( "Select All" ) ); +#else + d->id[ IdSelectAll ] = popup->insertItem( tr( "Select All" ) + ACCEL_KEY( A ) ); +#endif + +#ifndef TQT_NO_IM + TQInputContext *qic = getInputContext(); + if ( qic ) + qic->addMenusTo( popup ); +#endif + + popup->setItemEnabled( d->id[ IdUndo ], !isReadOnly() && doc->commands()->isUndoAvailable() ); + popup->setItemEnabled( d->id[ IdRedo ], !isReadOnly() && doc->commands()->isRedoAvailable() ); +#ifndef TQT_NO_CLIPBOARD + popup->setItemEnabled( d->id[ IdCut ], !isReadOnly() && doc->hasSelection( TQTextDocument::Standard, TRUE ) ); +#ifdef QT_TEXTEDIT_OPTIMIZATION + popup->setItemEnabled( d->id[ IdCopy ], d->optimMode ? optimHasSelection() : doc->hasSelection( TQTextDocument::Standard, TRUE ) ); +#else + popup->setItemEnabled( d->id[ IdCopy ], doc->hasSelection( TQTextDocument::Standard, TRUE ) ); +#endif + popup->setItemEnabled( d->id[ IdPaste ], !isReadOnly() && !TQApplication::clipboard()->text( d->clipboard_mode ).isEmpty() ); +#endif + const bool isEmptyDocument = (length() == 0); + popup->setItemEnabled( d->id[ IdClear ], !isReadOnly() && !isEmptyDocument ); + popup->setItemEnabled( d->id[ IdSelectAll ], !isEmptyDocument ); + return popup; +#else + return 0; +#endif +} + +/*! \overload + \obsolete + This function is called to create a right mouse button popup menu. + If you want to create a custom popup menu, reimplement this function + and return the created popup menu. Ownership of the popup menu is + transferred to the caller. + + This function is only called if createPopupMenu( const TQPoint & ) + returns 0. +*/ + +TQPopupMenu *TQTextEdit::createPopupMenu() +{ + return 0; +} + +/*! + \reimp +*/ + +void TQTextEdit::setFont( const TQFont &f ) +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + TQScrollView::setFont( f ); + doc->setDefaultFormat( f, doc->formatCollection()->defaultFormat()->color() ); + // recalculate the max string width + TQFontMetrics fm(f); + int i, sw; + d->od->maxLineWidth = 0; + for ( i = 0; i < d->od->numLines; i++ ) { + sw = fm.width(d->od->lines[LOGOFFSET(i)]); + if (d->od->maxLineWidth < sw) + d->od->maxLineWidth = sw; + } + resizeContents(d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1); + return; + } +#endif + TQScrollView::setFont( f ); + doc->setMinimumWidth( -1 ); + doc->setDefaultFormat( f, doc->formatCollection()->defaultFormat()->color() ); + lastFormatted = doc->firstParagraph(); + formatMore(); + repaintChanged(); +} + +/*! + \fn TQTextEdit::zoomIn() + + \overload + + Zooms in on the text by making the base font size one point + larger and recalculating all font sizes to be the new size. This + does not change the size of any images. + + \sa zoomOut() +*/ + +/*! + \fn TQTextEdit::zoomOut() + + \overload + + Zooms out on the text by making the base font size one point + smaller and recalculating all font sizes to be the new size. This + does not change the size of any images. + + \sa zoomIn() +*/ + + +/*! + Zooms in on the text by making the base font size \a range + points larger and recalculating all font sizes to be the new size. + This does not change the size of any images. + + \sa zoomOut() +*/ + +void TQTextEdit::zoomIn( int range ) +{ + TQFont f( TQScrollView::font() ); + TQFontInfo fi(f); + if (fi.pointSize() <= 0) { + f.setPixelSize( fi.pixelSize() + range ); + } else { + f.setPointSize( fi.pointSize() + range ); + } + setFont( f ); +} + +/*! + Zooms out on the text by making the base font size \a range points + smaller and recalculating all font sizes to be the new size. This + does not change the size of any images. + + \sa zoomIn() +*/ + +void TQTextEdit::zoomOut( int range ) +{ + TQFont f( TQScrollView::font() ); + TQFontInfo fi(f); + if (fi.pointSize() <= 0) { + f.setPixelSize( TQMAX( 1, fi.pixelSize() - range ) ); + } else { + f.setPointSize( TQMAX( 1, fi.pointSize() - range ) ); + } + setFont( f ); +} + +/*! + Zooms the text by making the base font size \a size points and + recalculating all font sizes to be the new size. This does not + change the size of any images. +*/ + +void TQTextEdit::zoomTo( int size ) +{ + TQFont f( TQScrollView::font() ); + f.setPointSize( size ); + setFont( f ); +} + +/*! + TQTextEdit is optimized for large amounts text. One of its + optimizations is to format only the visible text, formatting the rest + on demand, e.g. as the user scrolls, so you don't usually need to + call this function. + + In some situations you may want to force the whole text + to be formatted. For example, if after calling setText(), you wanted + to know the height of the document (using contentsHeight()), you + would call this function first. +*/ + +void TQTextEdit::sync() +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + TQFontMetrics fm( TQScrollView::font() ); + resizeContents( d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1 ); + } else +#endif + { + while ( lastFormatted ) { + lastFormatted->format(); + lastFormatted = lastFormatted->next(); + } + resizeContents( contentsWidth(), doc->height() ); + } + updateScrollBars(); +} + +/*! + \reimp +*/ + +void TQTextEdit::setEnabled( bool b ) +{ + TQScrollView::setEnabled( b ); + if ( textFormat() == PlainText ) { + TQTextFormat *f = doc->formatCollection()->defaultFormat(); + f->setColor( colorGroup().text() ); + updateContents(); + } +} + +/*! + Sets the background color of selection number \a selNum to \a back + and specifies whether the text of this selection should be + inverted with \a invertText. + + This only works for \a selNum > 0. The default selection (\a + selNum == 0) gets its attributes from the text edit's + colorGroup(). +*/ + +void TQTextEdit::setSelectionAttributes( int selNum, const TQColor &back, bool invertText ) +{ + if ( selNum < 1 ) + return; + if ( selNum > doc->numSelections() ) + doc->addSelection( selNum ); + doc->setSelectionColor( selNum, back ); + doc->setInvertSelectionText( selNum, invertText ); +} + +/*! + \reimp +*/ +void TQTextEdit::windowActivationChange( bool oldActive ) +{ + if ( oldActive && scrollTimer ) + scrollTimer->stop(); + if ( palette().active() != palette().inactive() ) + updateContents(); + TQScrollView::windowActivationChange( oldActive ); +} + +void TQTextEdit::setReadOnly( bool b ) +{ + if ( (bool) readOnly == b ) + return; + readOnly = b; +#ifndef TQT_NO_CURSOR + if ( readOnly ) + viewport()->setCursor( arrowCursor ); + else + viewport()->setCursor( ibeamCursor ); + setInputMethodEnabled( !readOnly ); +#endif +#ifdef QT_TEXTEDIT_OPTIMIZATION + checkOptimMode(); +#endif +} + +/*! + Scrolls to the bottom of the document and does formatting if + required. +*/ + +void TQTextEdit::scrollToBottom() +{ + sync(); + setContentsPos( contentsX(), contentsHeight() - visibleHeight() ); +} + +/*! + Returns the rectangle of the paragraph \a para in contents + coordinates, or an invalid rectangle if \a para is out of range. +*/ + +TQRect TQTextEdit::paragraphRect( int para ) const +{ + TQTextEdit *that = (TQTextEdit *)this; + that->sync(); + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return TQRect( -1, -1, -1, -1 ); + return p->rect(); +} + +/*! + Returns the paragraph which is at position \a pos (in contents + coordinates). +*/ + +int TQTextEdit::paragraphAt( const TQPoint &pos ) const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + TQFontMetrics fm( TQScrollView::font() ); + int parag = pos.y() / fm.lineSpacing(); + if ( parag <= d->od->numLines ) + return parag; + else + return 0; + } +#endif + TQTextCursor c( doc ); + c.place( pos, doc->firstParagraph() ); + if ( c.paragraph() ) + return c.paragraph()->paragId(); + return -1; // should never happen.. +} + +/*! + Returns the index of the character (relative to its paragraph) at + position \a pos (in contents coordinates). If \a para is not 0, + \a *para is set to the character's paragraph. +*/ + +int TQTextEdit::charAt( const TQPoint &pos, int *para ) const +{ +#ifdef QT_TEXTEDIT_OPTIMIZATION + if ( d->optimMode ) { + int par = paragraphAt( pos ); + if ( para ) + *para = par; + return optimCharIndex( d->od->lines[ LOGOFFSET(par) ], pos.x() ); + } +#endif + TQTextCursor c( doc ); + c.place( pos, doc->firstParagraph() ); + if ( c.paragraph() ) { + if ( para ) + *para = c.paragraph()->paragId(); + return c.index(); + } + return -1; // should never happen.. +} + +/*! + Sets the background color of the paragraph \a para to \a bg. +*/ + +void TQTextEdit::setParagraphBackgroundColor( int para, const TQColor &bg ) +{ + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return; + p->setBackgroundColor( bg ); + repaintChanged(); +} + +/*! + Clears the background color of the paragraph \a para, so that the + default color is used again. +*/ + +void TQTextEdit::clearParagraphBackground( int para ) +{ + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return; + p->clearBackgroundColor(); + repaintChanged(); +} + +/*! + Returns the background color of the paragraph \a para or an + invalid color if \a para is out of range or the paragraph has no + background set +*/ + +TQColor TQTextEdit::paragraphBackgroundColor( int para ) const +{ + TQTextParagraph *p = doc->paragAt( para ); + if ( !p ) + return TQColor(); + TQColor *c = p->backgroundColor(); + if ( c ) + return *c; + return TQColor(); +} + +/*! + \property TQTextEdit::undoRedoEnabled + \brief whether undo/redo is enabled + + When changing this property, the undo/redo history is cleared. + + The default is TRUE. +*/ + +void TQTextEdit::setUndoRedoEnabled( bool b ) +{ + undoRedoInfo.clear(); + doc->commands()->clear(); + + undoEnabled = b; +} + +bool TQTextEdit::isUndoRedoEnabled() const +{ + return undoEnabled; +} + +/*! + Returns TRUE if undo is available; otherwise returns FALSE. +*/ + +bool TQTextEdit::isUndoAvailable() const +{ + return undoEnabled && (doc->commands()->isUndoAvailable() || undoRedoInfo.valid()); +} + +/*! + Returns TRUE if redo is available; otherwise returns FALSE. +*/ + +bool TQTextEdit::isRedoAvailable() const +{ + return undoEnabled && doc->commands()->isRedoAvailable(); +} + +void TQTextEdit::ensureFormatted( TQTextParagraph *p ) +{ + while ( !p->isValid() ) { + if ( !lastFormatted ) + return; + formatMore(); + } +} + +/*! \internal */ +void TQTextEdit::updateCursor( const TQPoint & pos ) +{ + if ( isReadOnly() && linksEnabled() ) { + TQTextCursor c = *cursor; + placeCursor( pos, &c, TRUE ); + +#ifndef TQT_NO_NETWORKPROTOCOL + bool insideParagRect = TRUE; + if (c.paragraph() == doc->lastParagraph() + && c.paragraph()->rect().y() + c.paragraph()->rect().height() < pos.y()) + insideParagRect = FALSE; + if (insideParagRect && c.paragraph() && c.paragraph()->at( c.index() ) && + c.paragraph()->at( c.index() )->isAnchor()) { + if (!c.paragraph()->at( c.index() )->anchorHref().isEmpty() + && c.index() < c.paragraph()->length() - 1 ) + onLink = c.paragraph()->at( c.index() )->anchorHref(); + else + onLink = TQString::null; + + if (!c.paragraph()->at( c.index() )->anchorName().isEmpty() + && c.index() < c.paragraph()->length() - 1 ) + d->onName = c.paragraph()->at( c.index() )->anchorName(); + else + d->onName = TQString::null; + + if (!c.paragraph()->at( c.index() )->anchorHref().isEmpty() ) { +#ifndef TQT_NO_CURSOR + viewport()->setCursor( onLink.isEmpty() ? arrowCursor : pointingHandCursor ); +#endif + TQUrl u( doc->context(), onLink, TRUE ); + emitHighlighted( u.toString( FALSE, FALSE ) ); + } + } else { +#ifndef TQT_NO_CURSOR + viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); +#endif + onLink = TQString::null; + emitHighlighted( TQString::null ); + } +#endif + } +} + +/*! + Places the cursor \a c at the character which is closest to position + \a pos (in contents coordinates). If \a c is 0, the default text + cursor is used. + + \sa setCursorPosition() +*/ +void TQTextEdit::placeCursor( const TQPoint &pos, TQTextCursor *c ) +{ + placeCursor( pos, c, FALSE ); +} + +/*! \internal */ +void TQTextEdit::clipboardChanged() +{ +#ifndef TQT_NO_CLIPBOARD + // don't listen to selection changes + disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), this, 0); +#endif + selectAll(FALSE); +} + +/*! \property TQTextEdit::tabChangesFocus + \brief whether TAB changes focus or is accepted as input + + In some occasions text edits should not allow the user to input + tabulators or change indentation using the TAB key, as this breaks + the focus chain. The default is FALSE. + +*/ + +void TQTextEdit::setTabChangesFocus( bool b ) +{ + d->tabChangesFocus = b; +} + +bool TQTextEdit::tabChangesFocus() const +{ + return d->tabChangesFocus; +} + +#ifdef QT_TEXTEDIT_OPTIMIZATION +/* Implementation of optimized LogText mode follows */ + +static void tqSwap( int * a, int * b ) +{ + if ( !a || !b ) + return; + int tmp = *a; + *a = *b; + *b = tmp; +} + +/*! \internal */ +bool TQTextEdit::checkOptimMode() +{ + bool oldMode = d->optimMode; + if ( textFormat() == LogText ) { + setReadOnly( TRUE ); + d->optimMode = TRUE; + } else { + d->optimMode = FALSE; + } + + // when changing mode - try to keep selections and text + if ( oldMode != d->optimMode ) { + if ( d->optimMode ) { + d->od = new TQTextEditOptimPrivate; + connect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( optimDoAutoScroll() ) ); + disconnect( doc, TQ_SIGNAL( minimumWidthChanged(int) ), this, TQ_SLOT( documentWidthChanged(int) ) ); + disconnect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( autoScrollTimerDone() ) ); + disconnect( formatTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( formatMore() ) ); + optimSetText( doc->originalText() ); + doc->clear(TRUE); + delete cursor; + cursor = new TQTextCursor( doc ); + } else { + disconnect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( optimDoAutoScroll() ) ); + connect( doc, TQ_SIGNAL( minimumWidthChanged(int) ), this, TQ_SLOT( documentWidthChanged(int) ) ); + connect( scrollTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( autoScrollTimerDone() ) ); + connect( formatTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( formatMore() ) ); + setText( optimText() ); + delete d->od; + d->od = 0; + } + } + return d->optimMode; +} + +/*! \internal */ +TQString TQTextEdit::optimText() const +{ + TQString str, tmp; + + if ( d->od->len == 0 ) + return str; + + // concatenate all strings + int i; + int offset; + TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; + TQTextEditOptimPrivate::Tag * ftag = 0; + for ( i = 0; i < d->od->numLines; i++ ) { + if ( d->od->lines[ LOGOFFSET(i) ].isEmpty() ) { // CR lines are empty + str += "\n"; + } else { + tmp = d->od->lines[ LOGOFFSET(i) ] + "\n"; + // inject the tags for this line + if ( (it = d->od->tagIndex.find( LOGOFFSET(i) )) != d->od->tagIndex.end() ) + ftag = it.data(); + offset = 0; + while ( ftag && ftag->line == i ) { + tmp.insert( ftag->index + offset, "<" + ftag->tag + ">" ); + offset += ftag->tag.length() + 2; // 2 -> the '<' and '>' chars + ftag = ftag->next; + } + str += tmp; + } + } + return str; +} + +/*! \internal */ +void TQTextEdit::optimSetText( const TQString &str ) +{ + optimRemoveSelection(); +// this is just too slow - but may have to go in due to compatibility reasons +// if ( str == optimText() ) +// return; + d->od->numLines = 0; + d->od->lines.clear(); + d->od->maxLineWidth = 0; + d->od->len = 0; + d->od->clearTags(); + TQFontMetrics fm( TQScrollView::font() ); + if ( !(str.isEmpty() || str.isNull() || d->maxLogLines == 0) ) { + TQStringList strl = TQStringList::split( '\n', str, TRUE ); + int lWidth = 0; + for ( TQStringList::Iterator it = strl.begin(); it != strl.end(); ++it ) { + optimParseTags( &*it ); + optimCheckLimit( *it ); + lWidth = fm.width( *it ); + if ( lWidth > d->od->maxLineWidth ) + d->od->maxLineWidth = lWidth; + } + } + resizeContents( d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1 ); + repaintContents(); + emit textChanged(); +} + +/*! \internal + + Append \a tag to the tag list. +*/ +TQTextEditOptimPrivate::Tag * TQTextEdit::optimAppendTag( int index, const TQString & tag ) +{ + TQTextEditOptimPrivate::Tag * t = new TQTextEditOptimPrivate::Tag, * tmp; + + if ( d->od->tags == 0 ) + d->od->tags = t; + t->bold = t->italic = t->underline = FALSE; + t->line = d->od->numLines; + t->index = index; + t->tag = tag; + t->leftTag = 0; + t->parent = 0; + t->prev = d->od->lastTag; + if ( d->od->lastTag ) + d->od->lastTag->next = t; + t->next = 0; + d->od->lastTag = t; + tmp = d->od->tagIndex[ LOGOFFSET(t->line) ]; + if ( !tmp || (tmp && tmp->index > t->index) ) { + d->od->tagIndex.replace( LOGOFFSET(t->line), t ); + } + return t; +} + + /*! \internal + + Insert \a tag in the tag - according to line and index numbers +*/ + +TQTextEditOptimPrivate::Tag *TQTextEdit::optimInsertTag(int line, int index, const TQString &tag) +{ + TQTextEditOptimPrivate::Tag *t = new TQTextEditOptimPrivate::Tag, *tmp; + + if (d->od->tags == 0) + d->od->tags = t; + t->bold = t->italic = t->underline = FALSE; + t->line = line; + t->index = index; + t->tag = tag; + t->leftTag = 0; + t->parent = 0; + t->next = 0; + t->prev = 0; + + // find insertion pt. in tag struct. + TQMap<int,TQTextEditOptimPrivate::Tag *>::ConstIterator it; + if ((it = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { + tmp = *it; + if (tmp->index >= index) { // the exisiting tag may be placed AFTER the one we want to insert + tmp = tmp->prev; + } else { + while (tmp && tmp->next && tmp->next->line == line && tmp->next->index <= index) + tmp = tmp->next; + } + } else { + tmp = d->od->tags; + while (tmp && tmp->next && tmp->next->line < line) + tmp = tmp->next; + if (tmp == d->od->tags) + tmp = 0; + } + + t->prev = tmp; + t->next = tmp ? tmp->next : 0; + if (t->next) + t->next->prev = t; + if (tmp) + tmp->next = t; + + tmp = d->od->tagIndex[LOGOFFSET(t->line)]; + if (!tmp || (tmp && tmp->index >= t->index)) { + d->od->tagIndex.replace(LOGOFFSET(t->line), t); + } + return t; +} + + +/*! \internal + + Find tags in \a line, remove them from \a line and put them in a + structure. + + A tag is delimited by '<' and '>'. The characters '<', '>' and '&' + are escaped by using '<', '>' and '&'. Left-tags marks + the starting point for formatting, while right-tags mark the ending + point. A right-tag is the same as a left-tag, but with a '/' + appearing before the tag keyword. E.g a valid left-tag: <b>, and + a valid right-tag: </b>. Tags can be nested, but they have to be + closed in the same order as they are opened. E.g: + <font color=red><font color=blue>blue</font>red</font> - is valid, while: + <font color=red><b>bold red</font> just bold</b> - is invalid since the font tag is + closed before the bold tag. Note that a tag does not have to be + closed: '<font color=blue>Lots of text - and then some..' is perfectly valid for + setting all text appearing after the tag to blue. A tag can be used + to change the color of a piece of text, or set one of the following + formatting attributes: bold, italic and underline. These attributes + are set using the <b>, <i> and <u> tags. Example of valid tags: + <font color=red>, </font>, <b>, <u>, <i>, </i>. + Example of valid text: + This is some <font color=red>red text</font>, while this is some <font color=green>green + text</font>. <font color=blue><font color=yellow>This is yellow</font>, while this is + blue.</font> + + Note that only the color attribute of the HTML font tag is supported. + + Limitations: + 1. A tag cannot span several lines. + 2. Very limited error checking - mismatching left/right-tags is the + only thing that is detected. + +*/ +void TQTextEdit::optimParseTags( TQString * line, int lineNo, int indexOffset ) +{ + int len = line->length(); + int i, startIndex = -1, endIndex = -1, escIndex = -1; + int state = 0; // 0 = outside tag, 1 = inside tag + bool tagOpen, tagClose; + int bold = 0, italic = 0, underline = 0; + TQString tagStr; + TQPtrStack<TQTextEditOptimPrivate::Tag> tagStack; + + for ( i = 0; i < len; i++ ) { + tagOpen = (*line)[i] == '<'; + tagClose = (*line)[i] == '>'; + + // handle '<' and '>' and '&' + if ( (*line)[i] == '&' ) { + escIndex = i; + continue; + } else if ( escIndex != -1 && (*line)[i] == ';' ) { + TQString esc = line->mid( escIndex, i - escIndex + 1 ); + TQString c; + if ( esc == "<" ) + c = '<'; + else if ( esc == ">" ) + c = '>'; + else if ( esc == "&" ) + c = '&'; + line->replace( escIndex, i - escIndex + 1, c ); + len = line->length(); + i -= i-escIndex; + escIndex = -1; + continue; + } + + if ( state == 0 && tagOpen ) { + state = 1; + startIndex = i; + continue; + } + if ( state == 1 && tagClose ) { + state = 0; + endIndex = i; + if ( !tagStr.isEmpty() ) { + TQTextEditOptimPrivate::Tag * tag, * cur, * tmp; + bool format = TRUE; + + if ( tagStr == "b" ) + bold++; + else if ( tagStr == "/b" ) + bold--; + else if ( tagStr == "i" ) + italic++; + else if ( tagStr == "/i" ) + italic--; + else if ( tagStr == "u" ) + underline++; + else if ( tagStr == "/u" ) + underline--; + else + format = FALSE; + if ( lineNo > -1 ) + tag = optimInsertTag( lineNo, startIndex + indexOffset, tagStr ); + else + tag = optimAppendTag( startIndex, tagStr ); + // everything that is not a b, u or i tag is considered + // to be a color tag. + tag->type = format ? TQTextEditOptimPrivate::Format + : TQTextEditOptimPrivate::Color; + if ( tagStr[0] == '/' ) { + // this is a right-tag - search for the left-tag + // and possible parent tag + cur = tag->prev; + if ( !cur ) { +#ifdef QT_CHECK_RANGE + tqWarning( "TQTextEdit::optimParseTags: no left-tag for '<%s>' in line %d.", tag->tag.ascii(), tag->line + 1 ); +#endif + return; // something is wrong - give up + } + while ( cur ) { + if ( cur->leftTag ) { // push right-tags encountered + tagStack.push( cur ); + } else { + tmp = tagStack.pop(); + if ( !tmp ) { + if ( (("/" + cur->tag) == tag->tag) || + (tag->tag == "/font" && cur->tag.left(4) == "font") ) { + // set up the left and parent of this tag + tag->leftTag = cur; + tmp = cur->prev; + if ( tmp && tmp->parent ) { + tag->parent = tmp->parent; + } else if ( tmp && !tmp->leftTag ) { + tag->parent = tmp; + } + break; + } else if ( !cur->leftTag ) { +#ifdef QT_CHECK_RANGE + tqWarning( "TQTextEdit::optimParseTags: mismatching %s-tag for '<%s>' in line %d.", cur->tag[0] == '/' ? "left" : "right", cur->tag.ascii(), cur->line + 1 ); +#endif + return; // something is amiss - give up + } + } + } + cur = cur->prev; + } + } else { + tag->bold = bold > 0; + tag->italic = italic > 0; + tag->underline = underline > 0; + tmp = tag->prev; + while ( tmp && tmp->leftTag ) { + tmp = tmp->leftTag->parent; + } + if ( tmp ) { + tag->bold |= tmp->bold; + tag->italic |= tmp->italic; + tag->underline |= tmp->underline; + } + } + } + if ( startIndex != -1 ) { + int l = (endIndex == -1) ? + line->length() - startIndex : endIndex - startIndex; + line->remove( startIndex, l+1 ); + len = line->length(); + i -= l+1; + } + tagStr = ""; + continue; + } + + if ( state == 1 ) { + tagStr += (*line)[i]; + } + } +} + +// calculate the width of a string in pixels inc. tabs +static int qStrWidth(const TQString& str, int tabWidth, const TQFontMetrics& fm) +{ + int tabs = str.contains('\t'); + + if (!tabs) + return fm.width(str); + + int newIdx = 0; + int lastIdx = 0; + int strWidth = 0; + int tn; + for (tn = 1; tn <= tabs; ++tn) { + newIdx = str.find('\t', newIdx); + strWidth += fm.width(str.mid(lastIdx, newIdx - lastIdx)); + if (strWidth >= tn * tabWidth) { + int u = tn; + while (strWidth >= u * tabWidth) + ++u; + strWidth = u * tabWidth; + } else { + strWidth = tn * tabWidth; + } + lastIdx = ++newIdx; + } + if ((int)str.length() > newIdx) + strWidth += fm.width(str.mid(newIdx)); + return strWidth; +} + +bool TQTextEdit::optimHasBoldMetrics(int line) +{ + TQTextEditOptimPrivate::Tag *t; + TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; + if ((it = d->od->tagIndex.find(line)) != d->od->tagIndex.end()) { + t = *it; + while (t && t->line == line) { + if (t->bold) + return TRUE; + t = t->next; + } + } else if ((t = optimPreviousLeftTag(line)) && t->bold) { + return TRUE; + } + return FALSE; +} + +/*! \internal + + Append \a str to the current text buffer. Parses each line to find + formatting tags. +*/ +void TQTextEdit::optimAppend( const TQString &str ) +{ + if ( str.isEmpty() || str.isNull() || d->maxLogLines == 0 ) + return; + + TQStringList strl = TQStringList::split( '\n', str, TRUE ); + TQStringList::Iterator it = strl.begin(); + + TQFontMetrics fm(TQScrollView::font()); + int lWidth = 0; + + for ( ; it != strl.end(); ++it ) { + optimParseTags( &*it ); + optimCheckLimit( *it ); + if (optimHasBoldMetrics(d->od->numLines-1)) { + TQFont fnt = TQScrollView::font(); + fnt.setBold(TRUE); + fm = TQFontMetrics(fnt); + } + lWidth = qStrWidth(*it, tabStopWidth(), fm) + 4; + if ( lWidth > d->od->maxLineWidth ) + d->od->maxLineWidth = lWidth; + } + bool scrollToEnd = contentsY() >= contentsHeight() - visibleHeight(); + resizeContents( d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1 ); + if ( scrollToEnd ) { + updateScrollBars(); + ensureVisible( contentsX(), contentsHeight(), 0, 0 ); + } + // when a max log size is set, the text may not be redrawn because + // the size of the viewport may not have changed + if ( d->maxLogLines > -1 ) + viewport()->update(); + emit textChanged(); +} + + +static void qStripTags(TQString *line) +{ + int len = line->length(); + int i, startIndex = -1, endIndex = -1, escIndex = -1; + int state = 0; // 0 = outside tag, 1 = inside tag + bool tagOpen, tagClose; + + for ( i = 0; i < len; i++ ) { + tagOpen = (*line)[i] == '<'; + tagClose = (*line)[i] == '>'; + + // handle '<' and '>' and '&' + if ( (*line)[i] == '&' ) { + escIndex = i; + continue; + } else if ( escIndex != -1 && (*line)[i] == ';' ) { + TQString esc = line->mid( escIndex, i - escIndex + 1 ); + TQString c; + if ( esc == "<" ) + c = '<'; + else if ( esc == ">" ) + c = '>'; + else if ( esc == "&" ) + c = '&'; + line->replace( escIndex, i - escIndex + 1, c ); + len = line->length(); + i -= i-escIndex; + escIndex = -1; + continue; + } + + if ( state == 0 && tagOpen ) { + state = 1; + startIndex = i; + continue; + } + if ( state == 1 && tagClose ) { + state = 0; + endIndex = i; + if ( startIndex != -1 ) { + int l = (endIndex == -1) ? + line->length() - startIndex : endIndex - startIndex; + line->remove( startIndex, l+1 ); + len = line->length(); + i -= l+1; + } + continue; + } + } +} + +/*! \internal + + Inserts the text into \a line at index \a index. +*/ + +void TQTextEdit::optimInsert(const TQString& text, int line, int index) +{ + if (text.isEmpty() || d->maxLogLines == 0) + return; + if (line < 0) + line = 0; + if (line > d->od->numLines-1) + line = d->od->numLines-1; + if (index < 0) + index = 0; + if (index > (int) d->od->lines[line].length()) + index = d->od->lines[line].length(); + + TQStringList strl = TQStringList::split('\n', text, TRUE); + int numNewLines = (int)strl.count() - 1; + TQTextEditOptimPrivate::Tag *tag = 0; + TQMap<int,TQTextEditOptimPrivate::Tag *>::ConstIterator ii; + int x; + + if (numNewLines == 0) { + // Case 1. Fast single line case - just inject it! + TQString stripped = text; + qStripTags( &stripped ); + d->od->lines[LOGOFFSET(line)].insert(index, stripped); + // move the tag indices following the insertion pt. + if ((ii = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { + tag = *ii; + while (tag && (LOGOFFSET(tag->line) == line && tag->index < index)) + tag = tag->next; + while (tag && (LOGOFFSET(tag->line) == line)) { + tag->index += stripped.length(); + tag = tag->next; + } + } + stripped = text; + optimParseTags(&stripped, line, index); + } else if (numNewLines > 0) { + // Case 2. We have at least 1 newline char - split at + // insertion pt. and make room for new lines - complex and slow! + TQString left = d->od->lines[LOGOFFSET(line)].left(index); + TQString right = d->od->lines[LOGOFFSET(line)].mid(index); + + // rearrange lines for insertion + for (x = d->od->numLines - 1; x > line; x--) + d->od->lines[x + numNewLines] = d->od->lines[x]; + d->od->numLines += numNewLines; + + // fix the tag index and the tag line/index numbers - this + // might take a while.. + for (x = line; x < d->od->numLines; x++) { + if ((ii = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { + tag = ii.data(); + if (LOGOFFSET(tag->line) == line) + while (tag && (LOGOFFSET(tag->line) == line && tag->index < index)) + tag = tag->next; + } + } + + // relabel affected tags with new line numbers and new index + // positions + while (tag) { + if (LOGOFFSET(tag->line) == line) + tag->index -= index; + tag->line += numNewLines; + tag = tag->next; + } + + // generate a new tag index + d->od->tagIndex.clear(); + tag = d->od->tags; + while (tag) { + if (!((ii = d->od->tagIndex.find(LOGOFFSET(tag->line))) != d->od->tagIndex.end())) + d->od->tagIndex[LOGOFFSET(tag->line)] = tag; + tag = tag->next; + } + + // update the tag indices on the spliced line - needs to be done before new tags are added + TQString stripped = strl[strl.count() - 1]; + qStripTags(&stripped); + if ((ii = d->od->tagIndex.find(LOGOFFSET(line + numNewLines))) != d->od->tagIndex.end()) { + tag = *ii; + while (tag && (LOGOFFSET(tag->line) == line + numNewLines)) { + tag->index += stripped.length(); + tag = tag->next; + } + } + + // inject the new lines + TQStringList::Iterator it = strl.begin(); + x = line; + int idx; + for (; it != strl.end(); ++it) { + stripped = *it; + qStripTags(&stripped); + if (x == line) { + stripped = left + stripped; + idx = index; + } else { + idx = 0; + } + d->od->lines[LOGOFFSET(x)] = stripped; + optimParseTags(&*it, x++, idx); + } + d->od->lines[LOGOFFSET(x - 1)] += right; + } + // recalculate the pixel width of the longest injected line - + TQFontMetrics fm(TQScrollView::font()); + int lWidth = 0; + + for (x = line; x < line + numNewLines; x++) { + if (optimHasBoldMetrics(x)) { + TQFont fnt = TQScrollView::font(); + fnt.setBold(TRUE); + fm = TQFontMetrics(fnt); + } + lWidth = fm.width(d->od->lines[x]) + 4; + if (lWidth > d->od->maxLineWidth) + d->od->maxLineWidth = lWidth; + } + resizeContents(d->od->maxLineWidth + 4, d->od->numLines * fm.lineSpacing() + 1); + repaintContents(); + emit textChanged(); +} + + + +/*! \internal + + Returns the first open left-tag appearing before line \a line. + */ +TQTextEditOptimPrivate::Tag * TQTextEdit::optimPreviousLeftTag( int line ) +{ + TQTextEditOptimPrivate::Tag * ftag = 0; + TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; + if ( (it = d->od->tagIndex.find( LOGOFFSET(line) )) != d->od->tagIndex.end() ) + ftag = it.data(); + if ( !ftag ) { + // start searching for an open tag + ftag = d->od->tags; + while ( ftag ) { + if ( ftag->line > line || ftag->next == 0 ) { + if ( ftag->line > line ) + ftag = ftag->prev; + break; + } + ftag = ftag->next; + } + } else { + ftag = ftag->prev; + } + + if ( ftag ) { + if ( ftag && ftag->parent ) // use the open parent tag + ftag = ftag->parent; + else if ( ftag && ftag->leftTag ) // this is a right-tag with no parent + ftag = 0; + } + return ftag; +} + +/*! \internal + + Set the format for the string starting at index \a start and ending + at \a end according to \a tag. If \a tag is a Format tag, find the + first open color tag appearing before \a tag and use that tag to + color the string. +*/ +void TQTextEdit::optimSetTextFormat( TQTextDocument * td, TQTextCursor * cur, + TQTextFormat * f, int start, int end, + TQTextEditOptimPrivate::Tag * tag ) +{ + int formatFlags = TQTextFormat::Bold | TQTextFormat::Italic | + TQTextFormat::Underline; + cur->setIndex( start ); + td->setSelectionStart( 0, *cur ); + cur->setIndex( end ); + td->setSelectionEnd( 0, *cur ); + TQStyleSheetItem * ssItem = styleSheet()->item( tag->tag ); + if ( !ssItem || tag->type == TQTextEditOptimPrivate::Format ) { + f->setBold( tag->bold ); + f->setItalic( tag->italic ); + f->setUnderline( tag->underline ); + if ( tag->type == TQTextEditOptimPrivate::Format ) { + // check to see if there are any open color tags prior to + // this format tag + tag = tag->prev; + while ( tag && (tag->type == TQTextEditOptimPrivate::Format || + tag->leftTag) ) { + tag = tag->leftTag ? tag->parent : tag->prev; + } + } + if ( tag ) { + TQString col = tag->tag.simplifyWhiteSpace(); + if ( col.left( 10 ) == "font color" ) { + int i = col.find( '=', 10 ); + col = col.mid( i + 1 ).simplifyWhiteSpace(); + if ( col[0] == '\"' ) + col = col.mid( 1, col.length() - 2 ); + } + TQColor color = TQColor( col ); + if ( color.isValid() ) { + formatFlags |= TQTextFormat::Color; + f->setColor( color ); + } + } + } else { // use the stylesheet tag definition + if ( ssItem->color().isValid() ) { + formatFlags |= TQTextFormat::Color; + f->setColor( ssItem->color() ); + } + f->setBold( ssItem->fontWeight() == TQFont::Bold ); + f->setItalic( ssItem->fontItalic() ); + f->setUnderline( ssItem->fontUnderline() ); + } + td->setFormat( 0, f, formatFlags ); + td->removeSelection( 0 ); +} + +/*! \internal */ +void TQTextEdit::optimDrawContents( TQPainter * p, int clipx, int clipy, + int clipw, int cliph ) +{ + TQFontMetrics fm( TQScrollView::font() ); + int startLine = clipy / fm.lineSpacing(); + + // we always have to fetch at least two lines for drawing because the + // painter may be translated so that parts of two lines cover the area + // of a single line + int nLines = (cliph / fm.lineSpacing()) + 2; + int endLine = startLine + nLines; + + if ( startLine >= d->od->numLines ) + return; + if ( (startLine + nLines) > d->od->numLines ) + nLines = d->od->numLines - startLine; + + int i = 0; + TQString str; + for ( i = startLine; i < (startLine + nLines); i++ ) + str.append( d->od->lines[ LOGOFFSET(i) ] + "\n" ); + + TQTextDocument * td = new TQTextDocument( 0 ); + td->setDefaultFormat( TQScrollView::font(), TQColor() ); + td->setPlainText( str ); + td->setFormatter( new TQTextFormatterBreakWords ); // deleted by TQTextDoc + td->formatter()->setWrapEnabled( FALSE ); + td->setTabStops(doc->tabStopWidth()); + + // get the current text color from the current format + td->selectAll( TQTextDocument::Standard ); + TQTextFormat f; + f.setColor( colorGroup().text() ); + f.setFont( TQScrollView::font() ); + td->setFormat( TQTextDocument::Standard, &f, + TQTextFormat::Color | TQTextFormat::Font ); + td->removeSelection( TQTextDocument::Standard ); + + // add tag formatting + if ( d->od->tags ) { + int i = startLine; + TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; + TQTextEditOptimPrivate::Tag * tag = 0, * tmp = 0; + TQTextCursor cur( td ); + // Step 1 - find previous left-tag + tmp = optimPreviousLeftTag( i ); + for ( ; i < startLine + nLines; i++ ) { + if ( (it = d->od->tagIndex.find( LOGOFFSET(i) )) != d->od->tagIndex.end() ) + tag = it.data(); + // Step 2 - iterate over tags on the current line + int lastIndex = 0; + while ( tag && tag->line == i ) { + tmp = 0; + if ( tag->prev && !tag->prev->leftTag ) { + tmp = tag->prev; + } else if ( tag->prev && tag->prev->parent ) { + tmp = tag->prev->parent; + } + if ( (tag->index - lastIndex) > 0 && tmp ) { + optimSetTextFormat( td, &cur, &f, lastIndex, tag->index, tmp ); + } + lastIndex = tag->index; + tmp = tag; + tag = tag->next; + } + // Step 3 - color last part of the line - if necessary + if ( tmp && tmp->parent ) + tmp = tmp->parent; + if ( (cur.paragraph()->length()-1 - lastIndex) > 0 && tmp && !tmp->leftTag ) { + optimSetTextFormat( td, &cur, &f, lastIndex, + cur.paragraph()->length() - 1, tmp ); + } + cur.setParagraph( cur.paragraph()->next() ); + } + // useful debug info + // +// tag = d->od->tags; +// tqWarning("###"); +// while ( tag ) { +// tqWarning( "Tag: %p, parent: %09p, leftTag: %09p, Name: %-15s, ParentName: %s, %d%d%d", tag, +// tag->parent, tag->leftTag, tag->tag.latin1(), tag->parent ? tag->parent->tag.latin1():"<none>", +// tag->bold, tag->italic, tag->underline ); +// tag = tag->next; +// } + } + + // if there is a selection, make sure that the selection in the + // part we need to redraw is set correctly + if ( optimHasSelection() ) { + TQTextCursor c1( td ); + TQTextCursor c2( td ); + int selStart = d->od->selStart.line; + int idxStart = d->od->selStart.index; + int selEnd = d->od->selEnd.line; + int idxEnd = d->od->selEnd.index; + if ( selEnd < selStart ) { + tqSwap( &selStart, &selEnd ); + tqSwap( &idxStart, &idxEnd ); + } + if ( selEnd > d->od->numLines-1 ) { + selEnd = d->od->numLines-1; + } + if ( startLine <= selStart && endLine >= selEnd ) { + // case 1: area to paint covers entire selection + int paragS = selStart - startLine; + int paragE = paragS + (selEnd - selStart); + TQTextParagraph * parag = td->paragAt( paragS ); + if ( parag ) { + c1.setParagraph( parag ); + if ( td->text( paragS ).length() >= (uint) idxStart ) + c1.setIndex( idxStart ); + } + parag = td->paragAt( paragE ); + if ( parag ) { + c2.setParagraph( parag ); + if ( td->text( paragE ).length() >= (uint) idxEnd ) + c2.setIndex( idxEnd ); + } + } else if ( startLine > selStart && endLine < selEnd ) { + // case 2: area to paint is all part of the selection + td->selectAll( TQTextDocument::Standard ); + } else if ( startLine > selStart && endLine >= selEnd && + startLine <= selEnd ) { + // case 3: area to paint starts inside a selection, ends past it + c1.setParagraph( td->firstParagraph() ); + c1.setIndex( 0 ); + int paragE = selEnd - startLine; + TQTextParagraph * parag = td->paragAt( paragE ); + if ( parag ) { + c2.setParagraph( parag ); + if ( td->text( paragE ).length() >= (uint) idxEnd ) + c2.setIndex( idxEnd ); + } + } else if ( startLine <= selStart && endLine < selEnd && + endLine > selStart ) { + // case 4: area to paint starts before a selection, ends inside it + int paragS = selStart - startLine; + TQTextParagraph * parag = td->paragAt( paragS ); + if ( parag ) { + c1.setParagraph( parag ); + c1.setIndex( idxStart ); + } + c2.setParagraph( td->lastParagraph() ); + c2.setIndex( td->lastParagraph()->string()->toString().length() - 1 ); + + } + // previously selected? + if ( !td->hasSelection( TQTextDocument::Standard ) ) { + td->setSelectionStart( TQTextDocument::Standard, c1 ); + td->setSelectionEnd( TQTextDocument::Standard, c2 ); + } + } + td->doLayout( p, contentsWidth() ); + + // have to align the painter so that partly visible lines are + // drawn at the correct position within the area that needs to be + // painted + int offset = clipy % fm.lineSpacing() + 2; + TQRect r( clipx, 0, clipw, cliph + offset ); + p->translate( 0, clipy - offset ); + td->draw( p, r.x(), r.y(), r.width(), r.height(), colorGroup() ); + p->translate( 0, -(clipy - offset) ); + delete td; +} + +/*! \internal */ +void TQTextEdit::optimMousePressEvent( TQMouseEvent * e ) +{ + if ( e->button() != LeftButton ) + return; + + TQFontMetrics fm( TQScrollView::font() ); + mousePressed = TRUE; + mousePos = e->pos(); + d->od->selStart.line = e->y() / fm.lineSpacing(); + if ( d->od->selStart.line > d->od->numLines-1 ) { + d->od->selStart.line = d->od->numLines-1; + d->od->selStart.index = d->od->lines[ LOGOFFSET(d->od->numLines-1) ].length(); + } else { + TQString str = d->od->lines[ LOGOFFSET(d->od->selStart.line) ]; + d->od->selStart.index = optimCharIndex( str, mousePos.x() ); + } + d->od->selEnd.line = d->od->selStart.line; + d->od->selEnd.index = d->od->selStart.index; + oldMousePos = e->pos(); + repaintContents( FALSE ); +} + +/*! \internal */ +void TQTextEdit::optimMouseReleaseEvent( TQMouseEvent * e ) +{ + if ( e->button() != LeftButton ) + return; + + if ( scrollTimer->isActive() ) + scrollTimer->stop(); + if ( !inDoubleClick ) { + TQFontMetrics fm( TQScrollView::font() ); + d->od->selEnd.line = e->y() / fm.lineSpacing(); + if ( d->od->selEnd.line > d->od->numLines-1 ) { + d->od->selEnd.line = d->od->numLines-1; + } + TQString str = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ]; + mousePos = e->pos(); + d->od->selEnd.index = optimCharIndex( str, mousePos.x() ); + if ( d->od->selEnd.line < d->od->selStart.line ) { + tqSwap( &d->od->selStart.line, &d->od->selEnd.line ); + tqSwap( &d->od->selStart.index, &d->od->selEnd.index ); + } else if ( d->od->selStart.line == d->od->selEnd.line && + d->od->selStart.index > d->od->selEnd.index ) { + tqSwap( &d->od->selStart.index, &d->od->selEnd.index ); + } + oldMousePos = e->pos(); + repaintContents( FALSE ); + } + if ( mousePressed ) { + mousePressed = FALSE; + copyToClipboard(); + } + + inDoubleClick = FALSE; + emit copyAvailable( optimHasSelection() ); + emit selectionChanged(); +} + +/*! \internal */ +void TQTextEdit::optimMouseMoveEvent( TQMouseEvent * e ) +{ + mousePos = e->pos(); + optimDoAutoScroll(); + oldMousePos = mousePos; +} + +/*! \internal */ +void TQTextEdit::optimDoAutoScroll() +{ + if ( !mousePressed ) + return; + + TQFontMetrics fm( TQScrollView::font() ); + TQPoint pos( mapFromGlobal( TQCursor::pos() ) ); + bool doScroll = FALSE; + int xx = contentsX() + pos.x(); + int yy = contentsY() + pos.y(); + + // find out how much we have to scroll in either dir. + if ( pos.x() < 0 || pos.x() > viewport()->width() || + pos.y() < 0 || pos.y() > viewport()->height() ) { + int my = yy; + if ( pos.x() < 0 ) + xx = contentsX() - fm.width( 'w'); + else if ( pos.x() > viewport()->width() ) + xx = contentsX() + viewport()->width() + fm.width('w'); + + if ( pos.y() < 0 ) { + my = contentsY() - 1; + yy = (my / fm.lineSpacing()) * fm.lineSpacing() + 1; + } else if ( pos.y() > viewport()->height() ) { + my = contentsY() + viewport()->height() + 1; + yy = (my / fm.lineSpacing() + 1) * fm.lineSpacing() - 1; + } + d->od->selEnd.line = my / fm.lineSpacing(); + mousePos.setX( xx ); + mousePos.setY( my ); + doScroll = TRUE; + } else { + d->od->selEnd.line = mousePos.y() / fm.lineSpacing(); + } + + if ( d->od->selEnd.line < 0 ) { + d->od->selEnd.line = 0; + } else if ( d->od->selEnd.line > d->od->numLines-1 ) { + d->od->selEnd.line = d->od->numLines-1; + } + + TQString str = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ]; + d->od->selEnd.index = optimCharIndex( str, mousePos.x() ); + + // have to have a valid index before generating a paint event + if ( doScroll ) + ensureVisible( xx, yy, 1, 1 ); + + // if the text document is smaller than the height of the viewport + // - redraw the whole thing otherwise calculate the rect that + // needs drawing. + if ( d->od->numLines * fm.lineSpacing() < viewport()->height() ) { + repaintContents( contentsX(), contentsY(), width(), height(), FALSE ); + } else { + int h = TQABS(mousePos.y() - oldMousePos.y()) + fm.lineSpacing() * 2; + int y; + if ( oldMousePos.y() < mousePos.y() ) { + y = oldMousePos.y() - fm.lineSpacing(); + } else { + // expand paint area for a fully selected line + h += fm.lineSpacing(); + y = mousePos.y() - fm.lineSpacing()*2; + } + if ( y < 0 ) + y = 0; + repaintContents( contentsX(), y, width(), h, FALSE ); + } + + if ( (!scrollTimer->isActive() && pos.y() < 0) || pos.y() > height() ) + scrollTimer->start( 100, FALSE ); + else if ( scrollTimer->isActive() && pos.y() >= 0 && pos.y() <= height() ) + scrollTimer->stop(); +} + +/*! \internal + + Returns the index of the character in the string \a str that is + currently under the mouse pointer. +*/ +int TQTextEdit::optimCharIndex( const TQString &str, int mx ) const +{ + TQFontMetrics fm(TQScrollView::font()); + uint i = 0; + int dd, dist = 10000000; + int curpos = 0; + int strWidth; + mx = mx - 4; // ### get the real margin from somewhere + + if (!str.contains('\t') && mx > fm.width(str)) + return str.length(); + + while (i < str.length()) { + strWidth = qStrWidth(str.left(i), tabStopWidth(), fm); + dd = strWidth - mx; + if (TQABS(dd) <= dist) { + dist = TQABS(dd); + if (mx >= strWidth) + curpos = i; + } + ++i; + } + return curpos; +} + +/*! \internal */ +void TQTextEdit::optimSelectAll() +{ + d->od->selStart.line = d->od->selStart.index = 0; + d->od->selEnd.line = d->od->numLines - 1; + d->od->selEnd.index = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ].length(); + + repaintContents( FALSE ); + emit copyAvailable( optimHasSelection() ); + emit selectionChanged(); +} + +/*! \internal */ +void TQTextEdit::optimRemoveSelection() +{ + d->od->selStart.line = d->od->selEnd.line = -1; + d->od->selStart.index = d->od->selEnd.index = -1; + repaintContents( FALSE ); +} + +/*! \internal */ +void TQTextEdit::optimSetSelection( int startLine, int startIdx, + int endLine, int endIdx ) +{ + d->od->selStart.line = startLine; + d->od->selEnd.line = endLine; + d->od->selStart.index = startIdx; + d->od->selEnd.index = endIdx; +} + +/*! \internal */ +bool TQTextEdit::optimHasSelection() const +{ + if ( d->od->selStart.line != d->od->selEnd.line || + d->od->selStart.index != d->od->selEnd.index ) + return TRUE; + return FALSE; +} + +/*! \internal */ +TQString TQTextEdit::optimSelectedText() const +{ + TQString str; + + if ( !optimHasSelection() ) + return str; + + // concatenate all strings + if ( d->od->selStart.line == d->od->selEnd.line ) { + str = d->od->lines[ LOGOFFSET(d->od->selEnd.line) ].mid( d->od->selStart.index, + d->od->selEnd.index - d->od->selStart.index ); + } else { + int i = d->od->selStart.line; + str = d->od->lines[ LOGOFFSET(i) ].right( d->od->lines[ LOGOFFSET(i) ].length() - + d->od->selStart.index ) + "\n"; + i++; + for ( ; i < d->od->selEnd.line; i++ ) { + if ( d->od->lines[ LOGOFFSET(i) ].isEmpty() ) // CR lines are empty + str += "\n"; + else + str += d->od->lines[ LOGOFFSET(i) ] + "\n"; + } + str += d->od->lines[ LOGOFFSET(d->od->selEnd.line) ].left( d->od->selEnd.index ); + } + return str; +} + +/*! \internal */ +bool TQTextEdit::optimFind( const TQString & expr, bool cs, bool /*wo*/, + bool fw, int * para, int * index ) +{ + bool found = FALSE; + int parag = para ? *para : d->od->search.line, + idx = index ? *index : d->od->search.index, i; + + if ( d->od->len == 0 ) + return FALSE; + + for ( i = parag; fw ? i < d->od->numLines : i >= 0; fw ? i++ : i-- ) { + idx = fw ? d->od->lines[ LOGOFFSET(i) ].find( expr, idx, cs ) : + d->od->lines[ LOGOFFSET(i) ].findRev( expr, idx, cs ); + if ( idx != -1 ) { + found = TRUE; + break; + } else if ( fw ) + idx = 0; + } + + if ( found ) { + if ( index ) + *index = idx; + if ( para ) + *para = i; + d->od->search.index = idx + 1; + d->od->search.line = i; + optimSetSelection( i, idx, i, idx + expr.length() ); + TQFontMetrics fm( TQScrollView::font() ); + int h = fm.lineSpacing(); + int x = fm.width( d->od->lines[ LOGOFFSET(i) ].left( idx + expr.length()) ) + 4; + ensureVisible( x, i * h + h / 2, 1, h / 2 + 2 ); + repaintContents(); // could possibly be optimized + } + return found; +} + +/*! \reimp */ +void TQTextEdit::polish() +{ + // this will ensure that the last line is visible if text have + // been added to the widget before it is shown + if ( d->optimMode ) + scrollToBottom(); + TQWidget::polish(); +} + +/*! + Sets the maximum number of lines a TQTextEdit can hold in \c + LogText mode to \a limit. If \a limit is -1 (the default), this + signifies an unlimited number of lines. + + \warning Never use formatting tags that span more than one line + when the maximum log lines is set. When lines are removed from the + top of the buffer it could result in an unbalanced tag pair, i.e. + the left formatting tag is removed before the right one. + */ +void TQTextEdit::setMaxLogLines( int limit ) +{ + d->maxLogLines = limit; + if ( d->maxLogLines < -1 ) + d->maxLogLines = -1; + if ( d->maxLogLines == -1 ) + d->logOffset = 0; +} + +/*! + Returns the maximum number of lines TQTextEdit can hold in \c + LogText mode. By default the number of lines is unlimited, which + is signified by a value of -1. + */ +int TQTextEdit::maxLogLines() +{ + return d->maxLogLines; +} + +/*! + Check if the number of lines in the buffer is limited, and uphold + that limit when appending new lines. + */ +void TQTextEdit::optimCheckLimit( const TQString& str ) +{ + if ( d->maxLogLines > -1 && d->maxLogLines <= d->od->numLines ) { + // NB! Removing the top line in the buffer will potentially + // destroy the structure holding the formatting tags - if line + // spanning tags are used. + TQTextEditOptimPrivate::Tag *t = d->od->tags, *tmp, *itr; + TQPtrList<TQTextEditOptimPrivate::Tag> lst; + while ( t ) { + t->line -= 1; + // unhook the ptr from the tag structure + if ( ((uint) LOGOFFSET(t->line) < (uint) d->logOffset && + (uint) LOGOFFSET(t->line) < (uint) LOGOFFSET(d->od->numLines) && + (uint) LOGOFFSET(d->od->numLines) > (uint) d->logOffset) ) + { + if ( t->prev ) + t->prev->next = t->next; + if ( t->next ) + t->next->prev = t->prev; + if ( d->od->tags == t ) + d->od->tags = t->next; + if ( d->od->lastTag == t ) { + if ( t->prev ) + d->od->lastTag = t->prev; + else + d->od->lastTag = d->od->tags; + } + tmp = t; + t = t->next; + lst.append( tmp ); + delete tmp; + } else { + t = t->next; + } + } + // Remove all references to the ptrs we just deleted + itr = d->od->tags; + while ( itr ){ + for ( tmp = lst.first(); tmp; tmp = lst.next() ) { + if ( itr->parent == tmp ) + itr->parent = 0; + if ( itr->leftTag == tmp ) + itr->leftTag = 0; + } + itr = itr->next; + } + // ...in the tag index as well + TQMapIterator<int, TQTextEditOptimPrivate::Tag *> idx; + if ( (idx = d->od->tagIndex.find( d->logOffset )) != d->od->tagIndex.end() ) + d->od->tagIndex.remove( idx ); + + TQMapIterator<int,TQString> it; + if ( (it = d->od->lines.find( d->logOffset )) != d->od->lines.end() ) { + d->od->len -= (*it).length(); + d->od->lines.remove( it ); + d->od->numLines--; + d->logOffset = LOGOFFSET(1); + } + } + d->od->len += str.length(); + d->od->lines[ LOGOFFSET(d->od->numLines++) ] = str; +} + +#endif // QT_TEXTEDIT_OPTIMIZATION + +/*! + \property TQTextEdit::autoFormatting + \brief the enabled set of auto formatting features + + The value can be any combination of the values in the \c + AutoFormatting enum. The default is \c AutoAll. Choose \c AutoNone + to disable all automatic formatting. + + Currently, the only automatic formatting feature provided is \c + AutoBulletList; future versions of TQt may offer more. +*/ + +void TQTextEdit::setAutoFormatting( uint features ) +{ + d->autoFormatting = features; +} + +uint TQTextEdit::autoFormatting() const +{ + return d->autoFormatting; +} + +/*! + Returns the TQSyntaxHighlighter set on this TQTextEdit. 0 is + returned if no syntax highlighter is set. + */ +TQSyntaxHighlighter * TQTextEdit::syntaxHighlighter() const +{ + if (document()->preProcessor()) + return ((TQSyntaxHighlighterInternal *) document()->preProcessor())->highlighter; + else + return 0; +} + +#endif //TQT_NO_TEXTEDIT diff --git a/src/widgets/tqtextedit.h b/src/widgets/tqtextedit.h new file mode 100644 index 00000000..40906dbf --- /dev/null +++ b/src/widgets/tqtextedit.h @@ -0,0 +1,613 @@ +/**************************************************************************** +** +** Definition of the TQTextEdit class +** +** Created : 990101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTEDIT_H +#define TQTEXTEDIT_H + +#ifndef QT_H +#include "ntqscrollview.h" +#include "ntqstylesheet.h" +#include "tqptrvector.h" +#include "tqvaluelist.h" +#include "tqptrlist.h" +#endif // QT_H + +#ifndef TQT_NO_TEXTEDIT +// uncomment below to enable optimization mode - also uncomment the +// optimDoAutoScroll() private slot since moc ignores #ifdefs.. +#define QT_TEXTEDIT_OPTIMIZATION + +class TQPainter; +class TQTextDocument; +class TQTextCursor; +class TQKeyEvent; +class TQResizeEvent; +class TQMouseEvent; +class TQTimer; +class TQTextString; +class TQTextCommand; +class TQTextParagraph; +class TQTextFormat; +class TQFont; +class TQColor; +class TQTextEdit; +class TQTextBrowser; +class TQTextString; +struct TQUndoRedoInfoPrivate; +class TQPopupMenu; +class TQTextEditPrivate; +class TQSyntaxHighlighter; + +#ifdef QT_TEXTEDIT_OPTIMIZATION +class TQTextEditOptimPrivate +{ +public: + // Note: no left-tag has any value for leftTag or parent, and + // no right-tag has any formatting flags set. + enum TagType { Color = 0, Format = 1 }; + struct Tag { + TagType type:2; + bool bold:1; + bool italic:1; + bool underline:1; + int line; + int index; + Tag * leftTag; // ptr to left-tag in a left-right tag pair + Tag * parent; // ptr to parent left-tag in a nested tag + Tag * prev; + Tag * next; + TQString tag; + }; + TQTextEditOptimPrivate() + { + len = numLines = maxLineWidth = 0; + selStart.line = selStart.index = -1; + selEnd.line = selEnd.index = -1; + search.line = search.index = 0; + tags = lastTag = 0; + } + void clearTags() + { + Tag * itr = tags; + while ( tags ) { + itr = tags; + tags = tags->next; + delete itr; + } + tags = lastTag = 0; + tagIndex.clear(); + } + ~TQTextEditOptimPrivate() + { + clearTags(); + } + int len; + int numLines; + int maxLineWidth; + struct Selection { + int line; + int index; + }; + Selection selStart, selEnd, search; + Tag * tags, * lastTag; + TQMap<int, TQString> lines; + TQMap<int, Tag *> tagIndex; +}; +#endif + +class TQ_EXPORT TQTextEdit : public TQScrollView +{ + friend class TQTextBrowser; + friend class TQSyntaxHighlighter; + + TQ_OBJECT + TQ_ENUMS( WordWrap WrapPolicy ) + TQ_SETS( AutoFormatting ) + TQ_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat ) + TQ_PROPERTY( TQString text READ text WRITE setText ) + TQ_PROPERTY( TQBrush paper READ paper WRITE setPaper ) + TQ_PROPERTY( bool linkUnderline READ linkUnderline WRITE setLinkUnderline ) + TQ_PROPERTY( TQString documentTitle READ documentTitle ) + TQ_PROPERTY( int length READ length ) + TQ_PROPERTY( WordWrap wordWrap READ wordWrap WRITE setWordWrap ) + TQ_PROPERTY( int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth ) + TQ_PROPERTY( WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy ) + TQ_PROPERTY( bool hasSelectedText READ hasSelectedText ) + TQ_PROPERTY( TQString selectedText READ selectedText ) + TQ_PROPERTY( int undoDepth READ undoDepth WRITE setUndoDepth ) + TQ_PROPERTY( bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode ) + TQ_PROPERTY( bool modified READ isModified WRITE setModified DESIGNABLE false ) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) + TQ_PROPERTY( bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled ) + TQ_PROPERTY( int tabStopWidth READ tabStopWidth WRITE setTabStopWidth ) + TQ_PROPERTY( bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus ) + TQ_PROPERTY( AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting ) + +public: + enum WordWrap { + NoWrap, + WidgetWidth, + FixedPixelWidth, + FixedColumnWidth + }; + + enum WrapPolicy { + AtWordBoundary, + AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated + Anywhere, + AtWordOrDocumentBoundary + }; + + enum AutoFormatting { + AutoNone = 0, + AutoBulletList = 0x00000001, + AutoAll = 0xffffffff + }; + + enum KeyboardAction { + ActionBackspace, + ActionDelete, + ActionReturn, + ActionKill, + ActionWordBackspace, + ActionWordDelete + }; + + enum CursorAction { + MoveBackward, + MoveForward, + MoveWordBackward, + MoveWordForward, + MoveUp, + MoveDown, + MoveLineStart, + MoveLineEnd, + MoveHome, + MoveEnd, + MovePgUp, + MovePgDown + }; + + enum VerticalAlignment { + AlignNormal, + AlignSuperScript, + AlignSubScript + }; + + enum TextInsertionFlags { + RedoIndentation = 0x0001, + CheckNewLines = 0x0002, + RemoveSelected = 0x0004, + AsIMCompositionText = 0x0008, // internal use + WithIMSelection = 0x0010 // internal use + }; + + TQTextEdit( const TQString& text, const TQString& context = TQString::null, + TQWidget* parent=0, const char* name=0); + TQTextEdit( TQWidget* parent=0, const char* name=0 ); + virtual ~TQTextEdit(); + void setPalette( const TQPalette & ); + + TQString text() const; + TQString text( int para ) const; + TextFormat textFormat() const; + TQString context() const; + TQString documentTitle() const; + + void getSelection( int *paraFrom, int *indexFrom, + int *paraTo, int *indexTo, int selNum = 0 ) const; + virtual bool find( const TQString &expr, bool cs, bool wo, bool forward = TRUE, + int *para = 0, int *index = 0 ); + + int paragraphs() const; + int lines() const; + int linesOfParagraph( int para ) const; + int lineOfChar( int para, int chr ); + int length() const; + TQRect paragraphRect( int para ) const; + int paragraphAt( const TQPoint &pos ) const; + int charAt( const TQPoint &pos, int *para ) const; + int paragraphLength( int para ) const; + + TQStyleSheet* styleSheet() const; +#ifndef TQT_NO_MIME + TQMimeSourceFactory* mimeSourceFactory() const; +#endif + TQBrush paper() const; + bool linkUnderline() const; + + int heightForWidth( int w ) const; + + bool hasSelectedText() const; + TQString selectedText() const; + bool isUndoAvailable() const; + bool isRedoAvailable() const; + + WordWrap wordWrap() const; + int wrapColumnOrWidth() const; + WrapPolicy wrapPolicy() const; + + int tabStopWidth() const; + + TQString anchorAt( const TQPoint& pos ); + TQString anchorAt( const TQPoint& pos, AnchorAttribute a ); + + TQSize sizeHint() const; + + bool isReadOnly() const { return readOnly; } + + void getCursorPosition( int *parag, int *index ) const; + + bool isModified() const; + bool italic() const; + bool bold() const; + bool underline() const; + TQString family() const; + int pointSize() const; + TQColor color() const; + TQFont font() const; + TQFont currentFont() const; + int alignment() const; + int undoDepth() const; + + // do not use, will go away + virtual bool getFormat( int para, int index, TQFont *font, TQColor *color, VerticalAlignment *verticalAlignment ); + // do not use, will go away + virtual bool getParagraphFormat( int para, TQFont *font, TQColor *color, + VerticalAlignment *verticalAlignment, int *alignment, + TQStyleSheetItem::DisplayMode *displayMode, + TQStyleSheetItem::ListStyle *listStyle, + int *listDepth ); + + + bool isOverwriteMode() const { return overWrite; } + TQColor paragraphBackgroundColor( int para ) const; + + bool isUndoRedoEnabled() const; + bool eventFilter( TQObject *o, TQEvent *e ); + bool tabChangesFocus() const; + + void setAutoFormatting( uint features ); + uint autoFormatting() const; + TQSyntaxHighlighter *syntaxHighlighter() const; + +public slots: + void setEnabled( bool ); +#ifndef TQT_NO_MIME + virtual void setMimeSourceFactory( TQMimeSourceFactory* factory ); +#endif + virtual void setStyleSheet( TQStyleSheet* styleSheet ); + virtual void scrollToAnchor( const TQString& name ); + virtual void setPaper( const TQBrush& pap ); + virtual void setLinkUnderline( bool ); + + virtual void setWordWrap( WordWrap mode ); + virtual void setWrapColumnOrWidth( int ); + virtual void setWrapPolicy( WrapPolicy policy ); + + virtual void copy(); + virtual void append( const TQString& text ); + + void setText( const TQString &txt ) { setText( txt, TQString::null ); } + virtual void setText( const TQString &txt, const TQString &context ); + virtual void setTextFormat( TextFormat f ); + + virtual void selectAll( bool select = TRUE ); + virtual void setTabStopWidth( int ts ); + virtual void zoomIn( int range ); + virtual void zoomIn() { zoomIn( 1 ); } + virtual void zoomOut( int range ); + virtual void zoomOut() { zoomOut( 1 ); } + virtual void zoomTo( int size ); + + virtual void sync(); + virtual void setReadOnly( bool b ); + + virtual void undo(); + virtual void redo(); + virtual void cut(); + virtual void paste(); +#ifndef TQT_NO_CLIPBOARD + virtual void pasteSubType( const TQCString &subtype ); +#endif + virtual void clear(); + virtual void del(); + virtual void indent(); + virtual void setItalic( bool b ); + virtual void setBold( bool b ); + virtual void setUnderline( bool b ); + virtual void setFamily( const TQString &f ); + virtual void setPointSize( int s ); + virtual void setColor( const TQColor &c ); + virtual void setFont( const TQFont &f ); + virtual void setVerticalAlignment( VerticalAlignment a ); + virtual void setAlignment( int a ); + + // do not use, will go away + virtual void setParagType( TQStyleSheetItem::DisplayMode dm, TQStyleSheetItem::ListStyle listStyle ); + + virtual void setCursorPosition( int parag, int index ); + virtual void setSelection( int parag_from, int index_from, int parag_to, int index_to, int selNum = 0 ); + virtual void setSelectionAttributes( int selNum, const TQColor &back, bool invertText ); + virtual void setModified( bool m ); + virtual void resetFormat(); + virtual void setUndoDepth( int d ); + virtual void setFormat( TQTextFormat *f, int flags ); + virtual void ensureCursorVisible(); + virtual void placeCursor( const TQPoint &pos, TQTextCursor *c = 0 ); + virtual void moveCursor( CursorAction action, bool select ); + virtual void doKeyboardAction( KeyboardAction action ); + virtual void removeSelectedText( int selNum = 0 ); + virtual void removeSelection( int selNum = 0 ); + virtual void setCurrentFont( const TQFont &f ); + virtual void setOverwriteMode( bool b ) { overWrite = b; } + + virtual void scrollToBottom(); + + void insert( const TQString &text, uint insertionFlags = CheckNewLines | RemoveSelected ); // ## virtual in 4.0 + + // obsolete + virtual void insert( const TQString &text, bool, bool = TRUE, bool = TRUE ); + + virtual void insertAt( const TQString &text, int para, int index ); + virtual void removeParagraph( int para ); + virtual void insertParagraph( const TQString &text, int para ); + + virtual void setParagraphBackgroundColor( int para, const TQColor &bg ); + virtual void clearParagraphBackground( int para ); + + virtual void setUndoRedoEnabled( bool b ); + void setTabChangesFocus( bool b ); // ### make virtual in 4.0 + +#ifdef QT_TEXTEDIT_OPTIMIZATION + void polish(); + void setMaxLogLines( int numLines ); + int maxLogLines(); +#endif + +signals: + void textChanged(); + void selectionChanged(); + void copyAvailable( bool ); + void undoAvailable( bool yes ); + void redoAvailable( bool yes ); + void currentFontChanged( const TQFont &f ); + void currentColorChanged( const TQColor &c ); + void currentAlignmentChanged( int a ); + void currentVerticalAlignmentChanged( VerticalAlignment a ); + void cursorPositionChanged( TQTextCursor *c ); + void cursorPositionChanged( int para, int pos ); + void returnPressed(); + void modificationChanged( bool m ); + void clicked( int parag, int index ); + void doubleClicked( int parag, int index ); + +protected: + void repaintChanged(); + void updateStyles(); + void drawContents( TQPainter *p, int cx, int cy, int cw, int ch ); + bool event( TQEvent *e ); + void keyPressEvent( TQKeyEvent *e ); + void resizeEvent( TQResizeEvent *e ); + void viewportResizeEvent( TQResizeEvent* ); + void contentsMousePressEvent( TQMouseEvent *e ); + void contentsMouseMoveEvent( TQMouseEvent *e ); + void contentsMouseReleaseEvent( TQMouseEvent *e ); + void contentsMouseDoubleClickEvent( TQMouseEvent *e ); +#ifndef TQT_NO_WHEELEVENT + void contentsWheelEvent( TQWheelEvent *e ); +#endif + void imStartEvent( TQIMEvent * ); + void imComposeEvent( TQIMEvent * ); + void imEndEvent( TQIMEvent * ); +#ifndef TQT_NO_DRAGANDDROP + void contentsDragEnterEvent( TQDragEnterEvent *e ); + void contentsDragMoveEvent( TQDragMoveEvent *e ); + void contentsDragLeaveEvent( TQDragLeaveEvent *e ); + void contentsDropEvent( TQDropEvent *e ); +#endif + void contentsContextMenuEvent( TQContextMenuEvent *e ); + bool sendMouseEventToInputContext( TQMouseEvent *e ); + bool focusNextPrevChild( bool next ); + TQTextDocument *document() const; + TQTextCursor *textCursor() const; + void setDocument( TQTextDocument *doc ); + virtual TQPopupMenu *createPopupMenu( const TQPoint& pos ); + virtual TQPopupMenu *createPopupMenu(); + void drawCursor( bool visible ); + + void windowActivationChange( bool ); + +protected slots: + virtual void doChangeInterval(); + void sliderReleased(); // ### make virtual in 4.0 + +private slots: + void formatMore(); + void doResize(); + void autoScrollTimerDone(); + void blinkCursor(); + void setModified(); + void startDrag(); + void documentWidthChanged( int w ); + void clipboardChanged(); + +private: + struct TQ_EXPORT UndoRedoInfo { + enum Type { Invalid, Insert, Delete, Backspace, Return, RemoveSelected, Format, Style, IME }; + + UndoRedoInfo( TQTextDocument *dc ); + ~UndoRedoInfo(); + void clear(); + bool valid() const; + + TQUndoRedoInfoPrivate *d; + int id; + int index; + int eid; + int eindex; + TQTextFormat *format; + int flags; + Type type; + TQTextDocument *doc; + TQByteArray styleInformation; + }; + +private: + void updateCursor( const TQPoint & pos ); + void handleMouseMove( const TQPoint& pos ); + void drawContents( TQPainter * ); + virtual bool linksEnabled() const { return FALSE; } + void init(); + void checkUndoRedoInfo( UndoRedoInfo::Type t ); + void updateCurrentFormat(); + bool handleReadOnlyKeyEvent( TQKeyEvent *e ); + void makeParagVisible( TQTextParagraph *p ); + void normalCopy(); + void copyToClipboard(); +#ifndef TQT_NO_MIME + TQCString pickSpecial(TQMimeSource* ms, bool always_ask, const TQPoint&); + TQTextDrag *dragObject( TQWidget *parent = 0 ) const; +#endif +#ifndef TQT_NO_MIMECLIPBOARD + void pasteSpecial(const TQPoint&); +#endif + void setFontInternal( const TQFont &f ); + + virtual void emitHighlighted( const TQString & ) {} + virtual void emitLinkClicked( const TQString & ) {} + + void readFormats( TQTextCursor &c1, TQTextCursor &c2, TQTextString &text, bool fillStyles = FALSE ); + void clearUndoRedo(); + void paintDocument( bool drawAll, TQPainter *p, int cx = -1, int cy = -1, int cw = -1, int ch = -1 ); + void moveCursor( CursorAction action ); + void ensureFormatted( TQTextParagraph *p ); + void placeCursor( const TQPoint &pos, TQTextCursor *c, bool link ); + void updateMicroFocusHint(); + +#ifdef QT_TEXTEDIT_OPTIMIZATION + bool checkOptimMode(); + TQString optimText() const; + void optimSetText( const TQString &str ); + void optimAppend( const TQString &str ); + void optimInsert( const TQString &str, int line, int index ); + void optimDrawContents( TQPainter * p, int cx, int cy, int cw, int ch ); + void optimMousePressEvent( TQMouseEvent * e ); + void optimMouseReleaseEvent( TQMouseEvent * e ); + void optimMouseMoveEvent( TQMouseEvent * e ); + int optimCharIndex( const TQString &str, int mx ) const; + void optimSelectAll(); + void optimRemoveSelection(); + void optimSetSelection( int startLine, int startIdx, int endLine, + int endIdx ); + bool optimHasSelection() const; + TQString optimSelectedText() const; + bool optimFind( const TQString & str, bool, bool, bool, int *, int * ); + void optimParseTags( TQString * str, int lineNo = -1, int indexOffset = 0 ); + TQTextEditOptimPrivate::Tag * optimPreviousLeftTag( int line ); + void optimSetTextFormat( TQTextDocument *, TQTextCursor *, TQTextFormat * f, + int, int, TQTextEditOptimPrivate::Tag * t ); + TQTextEditOptimPrivate::Tag * optimAppendTag( int index, const TQString & tag ); + TQTextEditOptimPrivate::Tag * optimInsertTag( int line, int index, const TQString & tag ); + void optimCheckLimit( const TQString& str ); + bool optimHasBoldMetrics( int line ); + +private slots: + void optimDoAutoScroll(); +#endif // QT_TEXTEDIT_OPTIMIZATION + +private: +#ifndef TQT_NO_CLIPBOARD + void pasteSubType( const TQCString &subtype, TQMimeSource *m ); +#endif + +private: + TQTextDocument *doc; + TQTextCursor *cursor; + TQTimer *formatTimer, *scrollTimer, *changeIntervalTimer, *blinkTimer, *dragStartTimer; + TQTextParagraph *lastFormatted; + int interval; + UndoRedoInfo undoRedoInfo; + TQTextFormat *currentFormat; + int currentAlignment; + TQPoint oldMousePos, mousePos; + TQPoint dragStartPos; + TQString onLink; + WordWrap wrapMode; + WrapPolicy wPolicy; + int wrapWidth; + TQString pressedLink; + TQTextEditPrivate *d; + bool inDoubleClick : 1; + bool mousePressed : 1; + bool cursorVisible : 1; + bool blinkCursorVisible : 1; + bool noop: 1; //< Removed; keep as padding for binary compat or reuse if needed + bool modified : 1; + bool mightStartDrag : 1; + bool inDnD : 1; + bool readOnly : 1; + bool undoEnabled : 1; + bool overWrite : 1; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQTextEdit( const TQTextEdit & ); + TQTextEdit &operator=( const TQTextEdit & ); +#endif +}; + +inline TQTextDocument *TQTextEdit::document() const +{ + return doc; +} + +inline TQTextCursor *TQTextEdit::textCursor() const +{ + return cursor; +} + +inline void TQTextEdit::setCurrentFont( const TQFont &f ) +{ + TQTextEdit::setFontInternal( f ); +} + +#endif //TQT_NO_TEXTEDIT +#endif //TQTEXTVIEW_H diff --git a/src/widgets/tqtextview.cpp b/src/widgets/tqtextview.cpp new file mode 100644 index 00000000..a475d7b4 --- /dev/null +++ b/src/widgets/tqtextview.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Implementation of the TQTextView class +** +** Created : 990101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqtextview.h" + +#ifndef TQT_NO_TEXTVIEW + +/*! \class TQTextView + \brief The TQTextView class provides a rich-text viewer. + + \obsolete + + This class wraps a read-only \l TQTextEdit. + Use a \l TQTextEdit instead, and call setReadOnly(TRUE) + to disable editing. +*/ + +/*! \reimp */ + +TQTextView::TQTextView( const TQString& text, const TQString& context, + TQWidget *parent, const char *name ) + : TQTextEdit( text, context, parent, name ) +{ + setReadOnly( TRUE ); +} + +/*! \reimp */ + +TQTextView::TQTextView( TQWidget *parent, const char *name ) + : TQTextEdit( parent, name ) +{ + setReadOnly( TRUE ); +} + +/*! \reimp */ + +TQTextView::~TQTextView() +{ +} + +/*! + \property TQTextView::undoDepth + \brief the number of undoable steps +*/ + +/*! + \property TQTextView::overwriteMode + \brief whether new text overwrites or pushes aside existing text +*/ + +/*! + \property TQTextView::modified + \brief Whether the text view's contents have been modified. +*/ + +/*! + \property TQTextView::readOnly + \brief Whether the text view's contents are read only. +*/ + +/*! + \property TQTextView::undoRedoEnabled + \brief Whether undo and redo are enabled. +*/ + +#endif diff --git a/src/widgets/tqtextview.h b/src/widgets/tqtextview.h new file mode 100644 index 00000000..8970d10c --- /dev/null +++ b/src/widgets/tqtextview.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Definition of the TQTextView class +** +** Created : 990101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQTEXTVIEW_H +#define TQTEXTVIEW_H + +#ifndef QT_H +#include "tqtextedit.h" +#endif // QT_H + +#ifndef TQT_NO_TEXTVIEW + +class TQ_EXPORT TQTextView : public TQTextEdit +{ + TQ_OBJECT + TQ_OVERRIDE( int undoDepth DESIGNABLE false SCRIPTABLE false ) + TQ_OVERRIDE( bool overwriteMode DESIGNABLE false SCRIPTABLE false ) + TQ_OVERRIDE( bool modified SCRIPTABLE false) + TQ_OVERRIDE( bool readOnly DESIGNABLE false SCRIPTABLE false ) + TQ_OVERRIDE( bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false ) + +public: + TQTextView( const TQString& text, const TQString& context = TQString::null, + TQWidget* parent=0, const char* name=0); + TQTextView( TQWidget* parent=0, const char* name=0 ); + + virtual ~TQTextView(); + +private: +#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator= + TQTextView( const TQTextView & ); + TQTextView &operator=( const TQTextView & ); +#endif +}; + +#endif //TQT_NO_TEXTVIEW +#endif //TQTEXTVIEW_H diff --git a/src/xml/qsvgdevice.cpp b/src/xml/qsvgdevice.cpp index d2895838..852cc742 100644 --- a/src/xml/qsvgdevice.cpp +++ b/src/xml/qsvgdevice.cpp @@ -46,7 +46,7 @@ #include "tqmap.h" #include "ntqregexp.h" #include "tqvaluelist.h" -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "tqimage.h" #include "ntqpixmap.h" diff --git a/src/xml/tqdom.cpp b/src/xml/tqdom.cpp index 4feaf47a..c233afa7 100644 --- a/src/xml/tqdom.cpp +++ b/src/xml/tqdom.cpp @@ -45,8 +45,8 @@ #include "tqxml.h" #include "tqptrlist.h" #include "ntqdict.h" -#include "ntqtextstream.h" -#include "ntqtextcodec.h" +#include "tqtextstream.h" +#include "tqtextcodec.h" #include "ntqiodevice.h" #include "ntqregexp.h" #include "ntqbuffer.h" diff --git a/src/xml/tqxml.cpp b/src/xml/tqxml.cpp index 4a2b8615..f9fa14b7 100644 --- a/src/xml/tqxml.cpp +++ b/src/xml/tqxml.cpp @@ -39,7 +39,7 @@ **********************************************************************/ #include "tqxml.h" -#include "ntqtextcodec.h" +#include "tqtextcodec.h" #include "ntqbuffer.h" #include "ntqregexp.h" #include "tqptrstack.h" diff --git a/src/xml/tqxml.h b/src/xml/tqxml.h index fb685a21..d5500499 100644 --- a/src/xml/tqxml.h +++ b/src/xml/tqxml.h @@ -42,7 +42,7 @@ #define TQXML_H #ifndef QT_H -#include "ntqtextstream.h" +#include "tqtextstream.h" #include "ntqfile.h" #include "tqstring.h" #include "tqstringlist.h" diff --git a/tools/assistant/finddialog.ui b/tools/assistant/finddialog.ui index 160bb043..ed4bf64d 100644 --- a/tools/assistant/finddialog.ui +++ b/tools/assistant/finddialog.ui @@ -249,7 +249,7 @@ </tabstops> <includes> <include location="global" impldecl="in implementation">ntqstatusbar.h</include> - <include location="global" impldecl="in implementation">ntqtextbrowser.h</include> + <include location="global" impldecl="in implementation">tqtextbrowser.h</include> <include location="local" impldecl="in implementation">mainwindow.h</include> <include location="local" impldecl="in implementation">tabbedbrowser.h</include> <include location="local" impldecl="in implementation">finddialog.ui.h</include> diff --git a/tools/assistant/helpdialogimpl.cpp b/tools/assistant/helpdialogimpl.cpp index 0e8623b9..ab02f2a1 100644 --- a/tools/assistant/helpdialogimpl.cpp +++ b/tools/assistant/helpdialogimpl.cpp @@ -59,8 +59,8 @@ #include <ntqsettings.h> #include <ntqstatusbar.h> #include <ntqtabwidget.h> -#include <ntqtextbrowser.h> -#include <ntqtextstream.h> +#include <tqtextbrowser.h> +#include <tqtextstream.h> #include <ntqtimer.h> #include <ntqurl.h> #include <ntqvalidator.h> diff --git a/tools/assistant/helpwindow.cpp b/tools/assistant/helpwindow.cpp index 175bc577..349f8a4d 100644 --- a/tools/assistant/helpwindow.cpp +++ b/tools/assistant/helpwindow.cpp @@ -48,8 +48,8 @@ #include <ntqaction.h> #include <ntqfileinfo.h> #include <ntqevent.h> -#include <ntqtextstream.h> -#include <ntqtextcodec.h> +#include <tqtextstream.h> +#include <tqtextcodec.h> #if defined(Q_OS_WIN32) #include <windows.h> diff --git a/tools/assistant/helpwindow.h b/tools/assistant/helpwindow.h index 8ec8f04a..85cfad90 100644 --- a/tools/assistant/helpwindow.h +++ b/tools/assistant/helpwindow.h @@ -34,7 +34,7 @@ #ifndef HELPWINDOW_H #define HELPWINDOW_H -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> class MainWindow; class TQKeyEvent; diff --git a/tools/assistant/lib/qassistantclient.cpp b/tools/assistant/lib/qassistantclient.cpp index 56eda22e..87ba3bef 100644 --- a/tools/assistant/lib/qassistantclient.cpp +++ b/tools/assistant/lib/qassistantclient.cpp @@ -34,7 +34,7 @@ #include "ntqassistantclient.h" #include <ntqsocket.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqprocess.h> #include <ntqtimer.h> #include <ntqfileinfo.h> diff --git a/tools/assistant/main.cpp b/tools/assistant/main.cpp index 22bcedd6..df603969 100644 --- a/tools/assistant/main.cpp +++ b/tools/assistant/main.cpp @@ -46,7 +46,7 @@ #include <ntqguardedptr.h> #include <stdlib.h> #include <stdio.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #ifdef TQ_WS_WIN #define INDEX_CHECK( text ) if( i+1 >= argc ) { TQMessageBox::information( 0, "TQt Assistant", text ); return 1; } diff --git a/tools/assistant/mainwindow.ui b/tools/assistant/mainwindow.ui index bb06b004..6461c640 100644 --- a/tools/assistant/mainwindow.ui +++ b/tools/assistant/mainwindow.ui @@ -579,7 +579,7 @@ <include location="global" impldecl="in implementation">ntqpaintdevicemetrics.h</include> <include location="global" impldecl="in implementation">ntqsimplerichtext.h</include> <include location="global" impldecl="in implementation">ntqfileinfo.h</include> - <include location="global" impldecl="in implementation">ntqtextstream.h</include> + <include location="global" impldecl="in implementation">tqtextstream.h</include> <include location="global" impldecl="in implementation">ntqdockwindow.h</include> <include location="global" impldecl="in implementation">stdlib.h</include> <include location="global" impldecl="in implementation">ntqmime.h</include> diff --git a/tools/assistant/profile.cpp b/tools/assistant/profile.cpp index 12a787b3..37cf3576 100644 --- a/tools/assistant/profile.cpp +++ b/tools/assistant/profile.cpp @@ -32,7 +32,7 @@ **********************************************************************/ #include "profile.h" #include <tqxml.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <ntqfileinfo.h> #include <ntqregexp.h> #include <ntqdir.h> diff --git a/tools/designer/app/main.cpp b/tools/designer/app/main.cpp index 3a980ad7..17ed552b 100644 --- a/tools/designer/app/main.cpp +++ b/tools/designer/app/main.cpp @@ -43,7 +43,7 @@ #include "designerapp.h" -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqobjectlist.h> #include <ntqsettings.h> #include <ntqsplashscreen.h> diff --git a/tools/designer/designer/command.cpp b/tools/designer/designer/command.cpp index 51bb600a..fd33209b 100644 --- a/tools/designer/designer/command.cpp +++ b/tools/designer/designer/command.cpp @@ -54,7 +54,7 @@ #include <ntqmessagebox.h> #include <ntqlistbox.h> #include <ntqiconview.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <tqptrstack.h> #include <ntqheader.h> #include <ntqsplitter.h> diff --git a/tools/designer/designer/customwidgeteditorimpl.cpp b/tools/designer/designer/customwidgeteditorimpl.cpp index e3726e1d..3d3196f8 100644 --- a/tools/designer/designer/customwidgeteditorimpl.cpp +++ b/tools/designer/designer/customwidgeteditorimpl.cpp @@ -53,9 +53,9 @@ #include <ntqapplication.h> #include <ntqlistview.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqdom.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <ntqcheckbox.h> CustomWidgetEditor::CustomWidgetEditor( TQWidget *parent, MainWindow *mw ) diff --git a/tools/designer/designer/designerappiface.cpp b/tools/designer/designer/designerappiface.cpp index c6ac96c7..b808f323 100644 --- a/tools/designer/designer/designerappiface.cpp +++ b/tools/designer/designer/designerappiface.cpp @@ -44,7 +44,7 @@ #include "../shared/widgetdatabase.h" #include <ntqvariant.h> #include <ntqlistview.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqstatusbar.h> #include "pixmapcollection.h" #include "hierarchyview.h" diff --git a/tools/designer/designer/mainwindow.cpp b/tools/designer/designer/mainwindow.cpp index 18a4579f..6da30984 100644 --- a/tools/designer/designer/mainwindow.cpp +++ b/tools/designer/designer/mainwindow.cpp @@ -116,7 +116,7 @@ #include <ntqaccel.h> #include <ntqtooltip.h> #include <ntqsizegrip.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqassistantclient.h> #include <stdlib.h> diff --git a/tools/designer/designer/mainwindowactions.cpp b/tools/designer/designer/mainwindowactions.cpp index d7699dca..52b6e7a0 100644 --- a/tools/designer/designer/mainwindowactions.cpp +++ b/tools/designer/designer/mainwindowactions.cpp @@ -52,7 +52,7 @@ #include <ntqspinbox.h> #include <ntqinputdialog.h> #include <ntqdatetimeedit.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include "defs.h" #include "project.h" diff --git a/tools/designer/designer/metadatabase.cpp b/tools/designer/designer/metadatabase.cpp index 9203f7f8..90e32d33 100644 --- a/tools/designer/designer/metadatabase.cpp +++ b/tools/designer/designer/metadatabase.cpp @@ -55,7 +55,7 @@ #include <ntqdatetime.h> #include <ntqfile.h> #include <ntqfileinfo.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <stdlib.h> diff --git a/tools/designer/designer/multilineeditorimpl.cpp b/tools/designer/designer/multilineeditorimpl.cpp index 709ebd59..4e6013f6 100644 --- a/tools/designer/designer/multilineeditorimpl.cpp +++ b/tools/designer/designer/multilineeditorimpl.cpp @@ -39,7 +39,7 @@ #include "syntaxhighlighter_html.h" #include "widgetfactory.h" -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <./private/qrichtext_p.h> #include <ntqpushbutton.h> #include <ntqlayout.h> diff --git a/tools/designer/designer/multilineeditorimpl.h b/tools/designer/designer/multilineeditorimpl.h index 11c7233c..30b875ba 100644 --- a/tools/designer/designer/multilineeditorimpl.h +++ b/tools/designer/designer/multilineeditorimpl.h @@ -35,7 +35,7 @@ #define MULTILINEEDITORIMPL_H #include <ntqaction.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <private/qrichtext_p.h> #include "multilineeditor.h" diff --git a/tools/designer/designer/outputwindow.cpp b/tools/designer/designer/outputwindow.cpp index 89c0b055..4dc59ab4 100644 --- a/tools/designer/designer/outputwindow.cpp +++ b/tools/designer/designer/outputwindow.cpp @@ -37,7 +37,7 @@ #include "mainwindow.h" #include <ntqlistview.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqapplication.h> #include <ntqheader.h> #include <stdlib.h> diff --git a/tools/designer/designer/pixmapcollection.cpp b/tools/designer/designer/pixmapcollection.cpp index 0a94c591..22405ce1 100644 --- a/tools/designer/designer/pixmapcollection.cpp +++ b/tools/designer/designer/pixmapcollection.cpp @@ -37,7 +37,7 @@ #include <ntqmime.h> #include <ntqdir.h> #include <ntqfileinfo.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqimage.h> PixmapCollection::PixmapCollection( Project *pro ) diff --git a/tools/designer/designer/project.cpp b/tools/designer/designer/project.cpp index a21ac205..d567b79e 100644 --- a/tools/designer/designer/project.cpp +++ b/tools/designer/designer/project.cpp @@ -44,11 +44,11 @@ #include "outputwindow.h" #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqurl.h> #include <tqobjectlist.h> #include <ntqfeatures.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <tqdom.h> #include <ntqmessagebox.h> #include <ntqapplication.h> diff --git a/tools/designer/designer/projectsettingsimpl.cpp b/tools/designer/designer/projectsettingsimpl.cpp index d7663801..0a4a724d 100644 --- a/tools/designer/designer/projectsettingsimpl.cpp +++ b/tools/designer/designer/projectsettingsimpl.cpp @@ -42,7 +42,7 @@ #include "workspace.h" #include <ntqlineedit.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqcheckbox.h> #include <ntqfiledialog.h> #include <ntqcombobox.h> diff --git a/tools/designer/designer/propertyeditor.cpp b/tools/designer/designer/propertyeditor.cpp index 85b2b2ec..436d6a75 100644 --- a/tools/designer/designer/propertyeditor.cpp +++ b/tools/designer/designer/propertyeditor.cpp @@ -88,7 +88,7 @@ #include <ntqmultilineedit.h> // FIXME: obsolete #include <ntqsplitter.h> #include <tqdatatable.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <limits.h> diff --git a/tools/designer/designer/resource.cpp b/tools/designer/designer/resource.cpp index 1d0d3d2b..9655ee4e 100644 --- a/tools/designer/designer/resource.cpp +++ b/tools/designer/designer/resource.cpp @@ -76,8 +76,8 @@ #endif #include <ntqtabwidget.h> #include <ntqtabwidget.h> -#include <ntqtextcodec.h> -#include <ntqtextstream.h> +#include <tqtextcodec.h> +#include <tqtextstream.h> #include <ntqtooltip.h> #include <ntqwhatsthis.h> #include <tqwidget.h> diff --git a/tools/designer/designer/resource.h b/tools/designer/designer/resource.h index a8580dae..ff88271e 100644 --- a/tools/designer/designer/resource.h +++ b/tools/designer/designer/resource.h @@ -35,7 +35,7 @@ #define RESOURCE_H #include <tqstring.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqvariant.h> #include <tqvaluelist.h> #include <tqimage.h> diff --git a/tools/designer/designer/sourceeditor.cpp b/tools/designer/designer/sourceeditor.cpp index 32df118b..06ec283b 100644 --- a/tools/designer/designer/sourceeditor.cpp +++ b/tools/designer/designer/sourceeditor.cpp @@ -43,7 +43,7 @@ #include "sourcefile.h" #include "hierarchyview.h" #include <ntqmessagebox.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> SourceEditor::SourceEditor( TQWidget *parent, EditorInterface *iface, LanguageInterface *liface ) : TQVBox( parent, 0, WDestructiveClose ), iFace( iface ), lIface( liface ), obj( 0 ), pro( 0 ) diff --git a/tools/designer/designer/sourcefile.cpp b/tools/designer/designer/sourcefile.cpp index bdb6299d..200a06a8 100644 --- a/tools/designer/designer/sourcefile.cpp +++ b/tools/designer/designer/sourcefile.cpp @@ -33,7 +33,7 @@ #include "sourcefile.h" #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include "designerappiface.h" #include "sourceeditor.h" #include "metadatabase.h" diff --git a/tools/designer/designer/widgetfactory.cpp b/tools/designer/designer/widgetfactory.cpp index d5ef3df8..30f10c09 100644 --- a/tools/designer/designer/widgetfactory.cpp +++ b/tools/designer/designer/widgetfactory.cpp @@ -67,7 +67,7 @@ #include <ntqlineedit.h> #include <ntqspinbox.h> #include <ntqmultilineedit.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqlabel.h> #include <ntqlayout.h> #include <tqwidgetstack.h> @@ -80,8 +80,8 @@ #include <ntqslider.h> #include <ntqdial.h> #include <ntqprogressbar.h> -#include <ntqtextview.h> -#include <ntqtextbrowser.h> +#include <tqtextview.h> +#include <tqtextbrowser.h> #include <ntqframe.h> #include <ntqmetaobject.h> #include <tqwidgetstack.h> diff --git a/tools/designer/designer/workspace.cpp b/tools/designer/designer/workspace.cpp index fa02c86c..209dbba6 100644 --- a/tools/designer/designer/workspace.cpp +++ b/tools/designer/designer/workspace.cpp @@ -52,7 +52,7 @@ #include <tqobjectlist.h> #include <ntqworkspace.h> #include <ntqpopupmenu.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include "qcompletionedit.h" WorkspaceItem::WorkspaceItem( TQListView *parent, Project* p ) diff --git a/tools/designer/editor/editor.h b/tools/designer/editor/editor.h index 06039431..0be972de 100644 --- a/tools/designer/editor/editor.h +++ b/tools/designer/editor/editor.h @@ -34,7 +34,7 @@ #ifndef EDITOR_H #define EDITOR_H -#include <ntqtextedit.h> +#include <tqtextedit.h> struct Config; class ParenMatcher; diff --git a/tools/designer/editor/parenmatcher.cpp b/tools/designer/editor/parenmatcher.cpp index ddc4b883..9f72a65d 100644 --- a/tools/designer/editor/parenmatcher.cpp +++ b/tools/designer/editor/parenmatcher.cpp @@ -34,7 +34,7 @@ #include "parenmatcher.h" #include "paragdata.h" -#include "ntqtextedit.h" +#include "tqtextedit.h" #include <private/qrichtext_p.h> #include <ntqapplication.h> diff --git a/tools/designer/editor/yyindent.cpp b/tools/designer/editor/yyindent.cpp index d8498dc3..4851c572 100644 --- a/tools/designer/editor/yyindent.cpp +++ b/tools/designer/editor/yyindent.cpp @@ -1107,7 +1107,7 @@ int indentForBottomLine( const TQStringList& program, TQChar typedIn ) */ #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <errno.h> diff --git a/tools/designer/examples/addressbook/addressbook.ui.h b/tools/designer/examples/addressbook/addressbook.ui.h index 93f3d50e..2edd9f2b 100644 --- a/tools/designer/examples/addressbook/addressbook.ui.h +++ b/tools/designer/examples/addressbook/addressbook.ui.h @@ -9,7 +9,7 @@ #include "addressdetails.h" #include "search.h" #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqfiledialog.h> #include <ntqapplication.h> diff --git a/tools/designer/examples/richedit/richedit.ui b/tools/designer/examples/richedit/richedit.ui index 83b2381d..7f166440 100644 --- a/tools/designer/examples/richedit/richedit.ui +++ b/tools/designer/examples/richedit/richedit.ui @@ -5,7 +5,7 @@ <include location="global" impldecl="in implementation">ntqmessagebox.h</include> <include location="global" impldecl="in implementation">ntqapplication.h</include> <include location="global" impldecl="in implementation">ntqfiledialog.h</include> -<include location="global" impldecl="in implementation">ntqtextstream.h</include> +<include location="global" impldecl="in implementation">tqtextstream.h</include> <include location="local" implDecl="in declaration">richedit.ui.h</include> <variable>TQString fileName;</variable> <pixmapinproject/> diff --git a/tools/designer/plugins/dlg/dlg2ui.cpp b/tools/designer/plugins/dlg/dlg2ui.cpp index a8993465..2f6a6b1b 100644 --- a/tools/designer/plugins/dlg/dlg2ui.cpp +++ b/tools/designer/plugins/dlg/dlg2ui.cpp @@ -39,7 +39,7 @@ #include <ntqframe.h> #include <ntqmessagebox.h> #include <ntqregexp.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> /* Possible improvements: diff --git a/tools/designer/plugins/kdevdlg/kdevdlg2ui.h b/tools/designer/plugins/kdevdlg/kdevdlg2ui.h index ff7d1955..7ae909df 100644 --- a/tools/designer/plugins/kdevdlg/kdevdlg2ui.h +++ b/tools/designer/plugins/kdevdlg/kdevdlg2ui.h @@ -35,7 +35,7 @@ #ifndef KDEVDLG2UI_H #define KDEVDLG2UI_H -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqfile.h> #include <tqstringlist.h> diff --git a/tools/designer/plugins/rc/rc2ui.h b/tools/designer/plugins/rc/rc2ui.h index 87a6fb98..df2d1361 100644 --- a/tools/designer/plugins/rc/rc2ui.h +++ b/tools/designer/plugins/rc/rc2ui.h @@ -35,7 +35,7 @@ #ifndef RC2UI_H #define RC2UI_H -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqfile.h> #include <tqstringlist.h> diff --git a/tools/designer/shared/widgetdatabase.cpp b/tools/designer/shared/widgetdatabase.cpp index 5435526f..a7585d89 100644 --- a/tools/designer/shared/widgetdatabase.cpp +++ b/tools/designer/shared/widgetdatabase.cpp @@ -40,7 +40,7 @@ #include <tqstrlist.h> #include <ntqdict.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqcleanuphandler.h> #include <ntqfeatures.h> @@ -64,6 +64,7 @@ static bool was_in_setup = FALSE; // It will be removed afterwards static TQString converted_widgets[] = { + "TQTextBrowser", "TQTextEdit", "TQTextView", "TQWidget", "TQWidgetStack", }; size_t converted_widgets_size = sizeof(converted_widgets) / sizeof(TQString); diff --git a/tools/designer/tools/tqtcreatecw/main.cpp b/tools/designer/tools/tqtcreatecw/main.cpp index aef6cea6..d2fba00f 100644 --- a/tools/designer/tools/tqtcreatecw/main.cpp +++ b/tools/designer/tools/tqtcreatecw/main.cpp @@ -32,7 +32,7 @@ **********************************************************************/ #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqvaluelist.h> #include <tqstrlist.h> #include <ntqmetaobject.h> diff --git a/tools/designer/uic/uic.h b/tools/designer/uic/uic.h index 81aaa74a..93fdad2c 100644 --- a/tools/designer/uic/uic.h +++ b/tools/designer/uic/uic.h @@ -37,7 +37,7 @@ #include <tqstring.h> #include <tqstringlist.h> #include <tqmap.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqpalette.h> #include <ntqvariant.h> diff --git a/tools/designer/uilib/tqwidgetfactory.cpp b/tools/designer/uilib/tqwidgetfactory.cpp index e8e6c33a..420bdc8c 100644 --- a/tools/designer/uilib/tqwidgetfactory.cpp +++ b/tools/designer/uilib/tqwidgetfactory.cpp @@ -83,14 +83,14 @@ #include <ntqwizard.h> #include <ntqlcdnumber.h> #include <ntqprogressbar.h> -#include <ntqtextview.h> -#include <ntqtextbrowser.h> +#include <tqtextview.h> +#include <tqtextbrowser.h> #include <ntqdial.h> #include <ntqslider.h> #include <ntqframe.h> #include <tqwidgetstack.h> #include <ntqtoolbox.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqscrollbar.h> #include <ntqmainwindow.h> #include <ntqsplitter.h> diff --git a/tools/linguist/book/linguist-manager.leaf b/tools/linguist/book/linguist-manager.leaf index 9acf9263..15d2d736 100644 --- a/tools/linguist/book/linguist-manager.leaf +++ b/tools/linguist/book/linguist-manager.leaf @@ -56,12 +56,12 @@ An example of a complete \c .pro file with four translation source files: \index Chinese Language \index Japanese Language -\l QTextCodec::setCodecForTr() makes it possible to choose a +\l TQTextCodec::setCodecForTr() makes it possible to choose a 8-bit encoding for literal strings that appear within \c tr() calls. This is useful for applications whose source language is, for example, Chinese or Japanese. If no encoding is set, \c tr() uses Latin-1. -If you do use the \l QTextCodec::codecForTr() mechanism in your +If you do use the \l TQTextCodec::codecForTr() mechanism in your application, \e {Qt Linguist} needs you to set the \c DEFAULTCODEC entry in the \c .pro file as well. For example: \code diff --git a/tools/linguist/book/linguist-programmer.leaf b/tools/linguist/book/linguist-programmer.leaf index 120dab0f..eff9422c 100644 --- a/tools/linguist/book/linguist-programmer.leaf +++ b/tools/linguist/book/linguist-programmer.leaf @@ -669,13 +669,13 @@ Our \c main() function is defined in \c main.cpp as usual. \printline QTranslator \printuntil install -\index QTextCodec!locale() -\index locale()!QTextCodec +\index TQTextCodec!locale() +\index locale()!TQTextCodec \index LANG!Environment Variable \index Environment Variables!LANG We choose which translation to use according to the current locale. -\l QTextCodec::locale() can be influenced by setting the \c LANG +\l TQTextCodec::locale() can be influenced by setting the \c LANG environment variable, for example. Notice that the use of a naming convention that incorporates the locale for \c .qm message files, (and \c .ts files), makes it easy to implement choosing the diff --git a/tools/linguist/linguist/main.cpp b/tools/linguist/linguist/main.cpp index 92704776..59ea00c4 100644 --- a/tools/linguist/linguist/main.cpp +++ b/tools/linguist/linguist/main.cpp @@ -37,7 +37,7 @@ #include <ntqlabel.h> #include <ntqpixmap.h> #include <ntqtimer.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <ntqtranslator.h> #include <ntqsettings.h> #include <ntqsplashscreen.h> diff --git a/tools/linguist/linguist/msgedit.cpp b/tools/linguist/linguist/msgedit.cpp index cce5f279..d68dfa09 100644 --- a/tools/linguist/linguist/msgedit.cpp +++ b/tools/linguist/linguist/msgedit.cpp @@ -47,11 +47,11 @@ #include <ntqclipboard.h> #include <ntqlabel.h> #include <ntqlayout.h> -#include <ntqtextedit.h> +#include <tqtextedit.h> #include <ntqpalette.h> #include <ntqpushbutton.h> #include <tqstring.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqwhatsthis.h> #include <ntqvbox.h> #include <ntqmainwindow.h> diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp index 604187f3..de63b643 100644 --- a/tools/linguist/linguist/phrase.cpp +++ b/tools/linguist/linguist/phrase.cpp @@ -38,7 +38,7 @@ #include <ntqfile.h> #include <ntqmessagebox.h> #include <ntqregexp.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqxml.h> static TQString protect( const TQString& str ) diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 29561e09..a20bd5cc 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -40,7 +40,7 @@ #include <ntqregexp.h> #include <tqstring.h> #include <tqstringlist.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <errno.h> diff --git a/tools/linguist/lupdate/fetchtr.cpp b/tools/linguist/lupdate/fetchtr.cpp index 1539a57d..3295dbaf 100644 --- a/tools/linguist/lupdate/fetchtr.cpp +++ b/tools/linguist/lupdate/fetchtr.cpp @@ -36,7 +36,7 @@ #include <ntqfile.h> #include <ntqregexp.h> #include <tqstring.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <tqvaluestack.h> #include <tqxml.h> diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 3c0e170a..53213d0c 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -39,7 +39,7 @@ #include <ntqfileinfo.h> #include <tqstring.h> #include <tqstringlist.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <errno.h> #include <string.h> diff --git a/tools/linguist/shared/metatranslator.cpp b/tools/linguist/shared/metatranslator.cpp index 73e435d0..aabd5d28 100644 --- a/tools/linguist/shared/metatranslator.cpp +++ b/tools/linguist/shared/metatranslator.cpp @@ -37,8 +37,8 @@ #include <ntqcstring.h> #include <ntqfile.h> #include <ntqmessagebox.h> -#include <ntqtextcodec.h> -#include <ntqtextstream.h> +#include <tqtextcodec.h> +#include <tqtextstream.h> #include <tqxml.h> static bool encodingIsUtf8( const TQXmlAttributes& atts ) diff --git a/tools/linguist/shared/proparser.cpp b/tools/linguist/shared/proparser.cpp index fea00880..f4a6d8de 100644 --- a/tools/linguist/shared/proparser.cpp +++ b/tools/linguist/shared/proparser.cpp @@ -38,7 +38,7 @@ #include <ntqfileinfo.h> #include <ntqregexp.h> #include <tqstringlist.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #ifdef Q_OS_UNIX #include <unistd.h> diff --git a/tools/linguist/tutorial/tt2/main.cpp b/tools/linguist/tutorial/tt2/main.cpp index 80b60864..3c5a4f6d 100644 --- a/tools/linguist/tutorial/tt2/main.cpp +++ b/tools/linguist/tutorial/tt2/main.cpp @@ -8,7 +8,7 @@ #include <ntqapplication.h> #include <tqstring.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <ntqtranslator.h> int main( int argc, char **argv ) diff --git a/tools/linguist/tutorial/tt3/main.cpp b/tools/linguist/tutorial/tt3/main.cpp index aa69e799..45b5c572 100644 --- a/tools/linguist/tutorial/tt3/main.cpp +++ b/tools/linguist/tutorial/tt3/main.cpp @@ -8,7 +8,7 @@ #include <ntqapplication.h> #include <tqstring.h> -#include <ntqtextcodec.h> +#include <tqtextcodec.h> #include <ntqtranslator.h> int main( int argc, char **argv ) diff --git a/tools/maketqpf/main.cpp b/tools/maketqpf/main.cpp index 06ae1401..d08bf613 100644 --- a/tools/maketqpf/main.cpp +++ b/tools/maketqpf/main.cpp @@ -32,7 +32,7 @@ **********************************************************************/ #include <ntqapplication.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqscrollview.h> #include <ntqfile.h> #include <ntqfont.h> diff --git a/tools/msg2tqm/msg2tqm.cpp b/tools/msg2tqm/msg2tqm.cpp index 07c2ff46..d167455a 100644 --- a/tools/msg2tqm/msg2tqm.cpp +++ b/tools/msg2tqm/msg2tqm.cpp @@ -33,8 +33,8 @@ **********************************************************************/ #include <ntqfile.h> -#include <ntqtextstream.h> -#include <ntqtextcodec.h> +#include <tqtextstream.h> +#include <tqtextcodec.h> #include <ntqtranslator.h> #include <stdio.h> diff --git a/tools/qconfig/main.cpp b/tools/qconfig/main.cpp index a34e2a66..d246f33e 100644 --- a/tools/qconfig/main.cpp +++ b/tools/qconfig/main.cpp @@ -34,7 +34,7 @@ #include "main.h" #include <ntqapplication.h> #include <ntqfile.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqlistview.h> #include <ntqhbox.h> #include <ntqlabel.h> diff --git a/tools/qconfig/main.h b/tools/qconfig/main.h index 32ee6f2e..9075157c 100644 --- a/tools/qconfig/main.h +++ b/tools/qconfig/main.h @@ -34,7 +34,7 @@ #include <ntqmainwindow.h> #include <tqmap.h> #include <tqstringlist.h> -#include <ntqtextbrowser.h> +#include <tqtextbrowser.h> class ChoiceItem; class TQListViewItem; diff --git a/tools/qembed/qembed.cpp b/tools/qembed/qembed.cpp index 6aaa6070..18919b31 100644 --- a/tools/qembed/qembed.cpp +++ b/tools/qembed/qembed.cpp @@ -20,7 +20,7 @@ #include <ntqfile.h> #include <ntqfileinfo.h> #include <tqptrlist.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqdatetime.h> #include <tqimage.h> #include <ntqdict.h> diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 14edb1ef..c97d2f6c 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -52,7 +52,7 @@ #include <ntqstatusbar.h> #include <ntqsettings.h> #include <ntqmessagebox.h> -#include <ntqtextview.h> +#include <tqtextview.h> #include <ntqstyle.h> #include <stdlib.h> diff --git a/tools/tqtmergetr/tqtmergetr.cpp b/tools/tqtmergetr/tqtmergetr.cpp index 91296e37..b8925d2c 100644 --- a/tools/tqtmergetr/tqtmergetr.cpp +++ b/tools/tqtmergetr/tqtmergetr.cpp @@ -33,7 +33,7 @@ #include <ntqfile.h> #include <ntqbuffer.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <stdio.h> #include <stdlib.h> diff --git a/tools/tqvfb/skin.cpp b/tools/tqvfb/skin.cpp index 02a65b65..a46e0a69 100644 --- a/tools/tqvfb/skin.cpp +++ b/tools/tqvfb/skin.cpp @@ -37,7 +37,7 @@ #include <ntqbitmap.h> #include <ntqpixmap.h> -#include <ntqtextstream.h> +#include <tqtextstream.h> #include <ntqfile.h> #include <ntqpainter.h> #ifdef TQ_WS_MAC diff --git a/translations/qt_ar.ts b/translations/qt_ar.ts index 4d0c1395..e3934672 100644 --- a/translations/qt_ar.ts +++ b/translations/qt_ar.ts @@ -1626,7 +1626,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&تراجع</translation> diff --git a/translations/qt_ca.ts b/translations/qt_ca.ts index 8fac55f3..61b22815 100644 --- a/translations/qt_ca.ts +++ b/translations/qt_ca.ts @@ -1635,7 +1635,7 @@ per a més informació.</p></translation> </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Desfés</translation> diff --git a/translations/qt_cs.ts b/translations/qt_cs.ts index d26191d5..d0bfdc15 100644 --- a/translations/qt_cs.ts +++ b/translations/qt_cs.ts @@ -1635,7 +1635,7 @@ dalšími verzemi Unixu s grafickým prostředím X11. </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Zpět</translation> diff --git a/translations/qt_de.ts b/translations/qt_de.ts index def4f9f0..986c98b6 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -1733,7 +1733,7 @@ nach </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>Clear</source> <translation>Löschen</translation> diff --git a/translations/qt_es.ts b/translations/qt_es.ts index 920b7379..411439ee 100644 --- a/translations/qt_es.ts +++ b/translations/qt_es.ts @@ -1628,7 +1628,7 @@ a </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Deshacer</translation> diff --git a/translations/qt_fr.ts b/translations/qt_fr.ts index 0031c17d..19637ace 100644 --- a/translations/qt_fr.ts +++ b/translations/qt_fr.ts @@ -1759,7 +1759,7 @@ en </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>Clear</source> <translation>Effacer</translation> diff --git a/translations/qt_he.ts b/translations/qt_he.ts index 620381df..1e50c68c 100644 --- a/translations/qt_he.ts +++ b/translations/qt_he.ts @@ -1730,7 +1730,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&בטל</translation> diff --git a/translations/qt_it.ts b/translations/qt_it.ts index d78fa843..31d06ebd 100644 --- a/translations/qt_it.ts +++ b/translations/qt_it.ts @@ -1628,7 +1628,7 @@ in </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Annulla</translation> diff --git a/translations/qt_ja.ts b/translations/qt_ja.ts index d38794d9..a0e550df 100644 --- a/translations/qt_ja.ts +++ b/translations/qt_ja.ts @@ -1626,7 +1626,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>元に戻す(&U)</translation> diff --git a/translations/qt_nb.ts b/translations/qt_nb.ts index 2eac33c5..0e44d908 100644 --- a/translations/qt_nb.ts +++ b/translations/qt_nb.ts @@ -1628,7 +1628,7 @@ til </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Angre</translation> diff --git a/translations/qt_pt-br.ts b/translations/qt_pt-br.ts index 4ac6941e..69b81fa8 100644 --- a/translations/qt_pt-br.ts +++ b/translations/qt_pt-br.ts @@ -1628,7 +1628,7 @@ para </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Desfazer</translation> diff --git a/translations/qt_pt.ts b/translations/qt_pt.ts index 6d324852..5c6c7c9c 100644 --- a/translations/qt_pt.ts +++ b/translations/qt_pt.ts @@ -1628,7 +1628,7 @@ para </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Desfazer</translation> diff --git a/translations/qt_ru.ts b/translations/qt_ru.ts index 311d1bef..d1eea14d 100644 --- a/translations/qt_ru.ts +++ b/translations/qt_ru.ts @@ -1849,7 +1849,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>&Отменить</translation> diff --git a/translations/qt_sk.ts b/translations/qt_sk.ts index e95c9de1..c046fa35 100644 --- a/translations/qt_sk.ts +++ b/translations/qt_sk.ts @@ -1636,7 +1636,7 @@ Mac&nbsp;OS&nbsp;X, Linux, a mnohé ďalšie komerčné verzie Unixu. </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>V&rátiť späť</translation> diff --git a/translations/qt_tr.ts b/translations/qt_tr.ts index 7699ec50..11da42fa 100644 --- a/translations/qt_tr.ts +++ b/translations/qt_tr.ts @@ -1609,7 +1609,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation type="unfinished"></translation> diff --git a/translations/qt_zh-cn.ts b/translations/qt_zh-cn.ts index efb74b2f..f899c80c 100644 --- a/translations/qt_zh-cn.ts +++ b/translations/qt_zh-cn.ts @@ -1625,7 +1625,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>撤消(&U)</translation> diff --git a/translations/qt_zh-tw.ts b/translations/qt_zh-tw.ts index 235b7a61..4d808918 100644 --- a/translations/qt_zh-tw.ts +++ b/translations/qt_zh-tw.ts @@ -1626,7 +1626,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation>復原(&U)</translation> diff --git a/translations/template.ts b/translations/template.ts index 2f30ae67..e41f11f9 100644 --- a/translations/template.ts +++ b/translations/template.ts @@ -1607,7 +1607,7 @@ to </message> </context> <context> - <name>QTextEdit</name> + <name>TQTextEdit</name> <message> <source>&Undo</source> <translation type="unfinished"></translation> -- cgit v1.2.1